-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta
-
sparc
-
solaris_2.6
Name: ooR10001 Date: 12/15/2000
javax.swing.SpinnerListModel(Object[]) constructor has incorrect behaviour because
it doesn't throw IllegalArgumentException when argument is null or has zero length.
The javadoc says:
----------------------
SpinnerListModel
public SpinnerListModel(Object[] values)
Construct a SpinnerModel whose sequence of values is defined by the
specified array. The intial value of the model will be values[0].
If values is null or has zero length then an IllegalArugmentException
is thrown.
----------------------------------------------
Following test is demonstrate this bug:
----------------------------------------------
import javax.swing.SpinnerListModel;
public class test {
public static void main(String[] args) {
String status = "FAILED";
try {
SpinnerListModel model = new SpinnerListModel(new Object[] {});
} catch (NullPointerException npe) {
status = "OKAY";
} catch (IllegalArgumentException iae) {
status = "OKAY";
}
System.out.println(status);
}
}
----------------------
Test output:
----------------------
FAILED
----------------------
This needs to be fixed.
======================================================================
- duplicates
-
JDK-4400930 javax.swing.SpinnerListModel(List) constructor has incorrect behaviour
- Closed