-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.2.2
-
sparc
-
solaris_2.5
Name: dfC67450 Date: 07/12/99
Javadoc specs for
java.util.Hashtable(int initialCapacity, float loadFactor) states:
"Throws: IllegalArgumentException - if initial capacity is less than
zero or if the load factor is nonpositive."
However, in JDK 1.2.2 this method does not throw IllegalArgumentException
if load factor equal to Float.NaN is passed.
Here is the example demonstrating the bug:
------------- Test.java -------------------------
import java.util.Hashtable;
public class Test {
public static void main(String[] args) {
try {
Hashtable table = new Hashtable(0, Float.NaN);
System.out.println("FAILED: IllegalArgumentException expected.");
return;
} catch (IllegalArgumentException e) {
}
System.out.println("PASSED.OKAY");
}
}
------ Output under JDK 1.2.2 -------
FAILED: IllegalArgumentException expected.
======================================================================
- duplicates
-
JDK-4189594 Hashtable(size,NaN) should throw IllegalArgumentException
- Resolved