-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
1.2.2
-
sparc
-
solaris_2.5.1
-
Verified
Name: aaC67449 Date: 10/16/98
DefaultBoundedRangeModel(int newValue,int newExtent,int newMin,int newMax) constructor doesn't throw IllegalArgumentException when called with negative extent, but creates an object with an inconsistent state instead
javadoc says:"
DefaultBoundedRangeModel
public DefaultBoundedRangeModel(int value,
int extent,
int min,
int max)
Initializes value, extent, minimum and maximum. Adjusting is false. Throws an IllegalArgumentException if the following constraints aren't satisfied:
min <= value <= value+extent <= max
"
see example:
-------------- Example ------------
public class Test extends JApplet{
public static void main(String argv[]) {
try {
DefaultBoundedRangeModel c = new DefaultBoundedRangeModel(0,-10,0,100);
System.out.println("FAILED: !(value <= value+extent)");
System.out.println(" value extent min max");
System.out.println("Is: "
+c.getValue()+" "
+c.getExtent()+" "
+c.getMinimum()+" "
+c.getMaximum());
} catch(IllegalArgumentException iae) { // Test no exceptions thr
System.out.println("PASSED");
}
}
}
--------------- output----------
FAILED: !(value <= value+extent)
value extent min max
Is: 0 -10 0 100
======================================================================