Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 107930 - [CellEditors] JFace ComboBoxCellEditor throws exception if invalid
Summary: [CellEditors] JFace ComboBoxCellEditor throws exception if invalid
Status: RESOLVED DUPLICATE of bug 60462
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Eric Moffatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-24 16:09 EDT by Richard Kulp CLA
Modified: 2005-08-25 10:45 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Kulp CLA 2005-08-24 16:09:58 EDT
The following code in ComboCellEditor:

    void applyEditorValueAndDeactivate() {
        //	must set the selection before getting value
        selection = comboBox.getSelectionIndex();
        Object newValue = doGetValue();
        markDirty();
        boolean isValid = isCorrect(newValue);
        setValueValid(isValid);
        if (!isValid) {
            // try to insert the current value into the error message.
            setErrorMessage(MessageFormat.format(getErrorMessage(),
                    new Object[] { items[selection] }));
        }
        fireApplyEditorValue();
        deactivate();
    }

Has a problem in the MessageFormat.format(...) with items[selection]. If nothing
is selected then the selection is -1, but -1 is not valid for the array lookup
so it crashes and throws an ArrayIndexOutOfBounds exception and blows things up.
Comment 1 Eric Moffatt CLA 2005-08-25 10:45:43 EDT

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