United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4287053 General Exception checking in JTabbedPane.java methods.
JDK-4287053 : General Exception checking in JTabbedPane.java methods.

Details
Type:
Bug
Submit Date:
1999-11-02
Status:
Resolved
Updated Date:
2001-01-17
Project Name:
JDK
Resolved Date:
2001-01-17
Component:
client-libs
OS:
solaris_2.6,windows_nt
Sub-Component:
javax.swing
CPU:
x86,sparc
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.2.2
Fixed Versions:
1.4.0 (beta)

Related Reports
Relates:
Relates:

Sub Tasks

Description
While testing JTabbedPane.removeTabAt(int index) I found that an ArrayIndexOutOfBoundsException was thrown when index is great then
tabCount size. If the user has 2 tabs and tries to removeTabAt(-1)
you get an ArrayIndexOutOfBoundsException. Also if the user tries to
removeTabAt(5) an ArrayIndexOutOfBoundsException gets thrown. Yet in the remove(Component component) if we make a call to remove(notAComponentInTabbedPane) the it does nothing. No ArrayIndexOutOfBoundsException was thrown. It appears to be inconsistent between
the two remove methods and the docs. This is manifested in most of the methods in JTabbedPane. I am filing one bug on this. The docs do not make reference to Exception handling yet we throw ArrayIndexOutOfBoundsException; but in remove() method we silently pass the call and don't throw an Exception. How should this work.

                                    

Comments
EVALUATION

It's true - the exception handling is completely inconsistent across
all the methods.  We should make it consistent and document appropriately.

amy.fowler@Eng 2000-12-14
                                     
2000-12-14
SUGGESTED FIX

We should test the bounds of the methods and either silently do nothing or throw an IllegalArgumentException. We should also update the java docs for this as well. I have tested this is my source base and it seems like this will not
affect other areas.
                                     
2004-06-11
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
merlin
merlin-beta

FIXED IN:
merlin-beta

INTEGRATED IN:
merlin-beta


                                     
2004-06-14



Hardware and Software, Engineered to Work Together