Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 67698 - [Viewers] JFace ComboBoxCellEditor throws exception on invalid values
Summary: [Viewers] JFace ComboBoxCellEditor throws exception on invalid values
Status: RESOLVED DUPLICATE of bug 60462
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P4 normal (vote)
Target Milestone: ---   Edit
Assignee: Boris Bokowski CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 67217
  Show dependency tree
 
Reported: 2004-06-17 15:03 EDT by Richard Kulp CLA
Modified: 2005-11-08 10:21 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Kulp CLA 2004-06-17 15:03:31 EDT
If an invalid value is sent into a combobox celleditor (i.e. it is not one of
the valid indexes the cell editor can support), the
applyEditorValueAndDeactivate() method throws an ArrayIndexOutOfBounds exception.

Here is the code that throws the exception: 

if (!isValid) {
	// try to insert the current value into the error message.
	setErrorMessage(
		MessageFormat.format(getErrorMessage(), new Object[] {items[selection]})); 
}

It throws the exception on items[selection] because the value of selection is
invalid. Since it is invalid to get here, it should be able to handle this case.
The items[selection] should be replaced by:

(selection >= 0 && selection < items.length) ? items[selection] : "?"

This way it can handle something invalid and not throw an exception.

Thanks,
Rich
Comment 1 Debbie Wilson CLA 2004-06-17 15:13:57 EDT
Which version of 3.0 are you using?
Comment 2 Richard Kulp CLA 2004-06-17 15:44:40 EDT
I20040616 eclipse driver.
Comment 3 Boris Bokowski CLA 2005-11-08 10:21:38 EST

*** This bug has been marked as a duplicate of 60462 ***