0

Zk Listbox onSelect indexOfBoundsException

asked 2014-12-09 12:02:16 +0800

javiut gravatar image javiut flag of Venezuela, Bolivarian Republic of
90 1 5

updated 2014-12-09 12:02:48 +0800

I have a listbox like this

 <listbox id="results" height='97%' onSelect="runMethod(self);">

In runMethod i have some code like this

results.getModel().getElementAt(lb.getSelectedIndex()));

The problem is we are receiving sometimes the infamous

java.lang.ArrayIndexOutOfBoundsException: -1

I think the problem is here

lb.getSelectedIndex()

My question is.. is possible that Listbox onSelect event is fired even if listbox has no selected index i mean lb.getSelectedIndex() returns -1?

If so what circumstances would do so...

Any help is hugely appeciate best regards from Venezuela...

delete flag offensive retag edit

Comments

can't you check if the selected index isn't -1 before you ask the element from the model?

chillworld ( 2014-12-09 15:00:51 +0800 )edit

Yes.. but i need to reproduce it to be able to fixed because i work remote and i need to be able to solved it the issue reproduce it... is weird i know.

javiut ( 2014-12-09 15:05:27 +0800 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-12-09 13:45:35 +0800

cyiannoulis gravatar image cyiannoulis
1201 10

I think there was a bug fix for this but i cannot remember in which version it was applied. Maybe if you search the issue tracker?

Costas

link publish delete flag offensive edit

Comments

do you have any idea if this problem is in version 6.5.3

javiut ( 2014-12-09 14:29:47 +0800 )edit

I would suggest to make a quick check with ZK 6.5.4

cyiannoulis ( 2014-12-09 16:56:57 +0800 )edit
0

answered 2014-12-14 09:09:35 +0800

Darksu gravatar image Darksu
1991 1 4

Hello javiut,

I will recommend something a little different.

Please change your listbox by adding the selectedItem property.

This way you will have the selected item of the listbox, and you will also be able to add your functionality in your java code.

Please try it out, and let me know the results.

Best Regards,

Darksu

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-12-09 12:02:16 +0800

Seen: 19 times

Last updated: Dec 14 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More