| | | | Browse by category |
Article ID: 1070
Last updated: 02 Feb, 2008
Problem
If you run the demo
Cause
The index return value wasn't being checked for valid values.
Action
If you run the demo
com
oguewaveexampleslendshortcutbarv2_0index.html
and do the following:
- Click on Outlook and then Other.
- Click on both items (Florence and Salisbury)
you will get the following exceptions:
Exception occurred during event dispatching:
java.lang.ArrayIndexOutOfBoundsException: -1 < 0
at java.lang.Throwable.(Compiled Code)
at java.util.Vector.elementAt(Compiled Code)
at com.roguewave.blend.shortcutbar.v2_0.ShortcutBarGroup.getAssociatedPanel(Compiled Code)
at com.roguewave.blend.shortcutbar.v2_0.ShortcutBar.itemStateChanged(Compiled Code)
at com.roguewave.blend.listbox.v2_0.ListBox.processItemEvent(Compiled Code)
at com.roguewave.blend.listbox.v2_0.ListBox.deselectAll(Compiled Code)
at com.roguewave.blend.listbox.v2_0.ListBox.mouseDown(Compiled Code)
at com.roguewave.blend.listbox.v2_0.ListBox.processEvent(Compiled Code)
at java.awt.Component.dispatchEventImpl(Compiled Code)
at java.awt.Container.dispatchEventImpl(Compiled Code)
at java.awt.EventDispatchThread.run(Compiled Code)
Cause
The index return value wasn't being checked for valid values.
Action
Add this line:
if (index<0) return null;
to line 76 of
The entire method should look like this:
/**
* This will basically take the item chosen from the component, get its
* index within the component, and then pass the same indexed panel from
* m_vPanels (again, defeating having to use HashTables ;))
*/
protected Panel getAssociatedPanel() {
int index = ((IShortcutBar)m_cpList).getSelectedIndex();
if (index<0) return null; //added to validate the index
Panel p = (Panel)m_vPanels.elementAt(index);
return p;
This article was:
Helpful |
Not helpful
Report an issue
Article ID: 1070
Last updated: 02 Feb, 2008
Revision: 1
Views: 2626
Posted: 13 Oct, 1998 by
Dean J.
Updated: 02 Feb, 2008 by
Dean J.
Others in this category
Powered by KBPublisher (Knowledge base software)