Name: dkC59003 Date: 08/10/99
Behavior of method Thread.sleep() with negative argument is different under
different JDK versions. The following program throws IllegalArgumentException
being started under JDK1.2, JDK1.1.8 and under JDK1.3 with "-classic" key. But
the same class just hangs being started under JDK1.3L (K,J) without "-classic".
The bug appeares on WindowsNT.
The specification does not answer what behavior is right. Note that the
"Java Class Libraries" reads (p. 1743):
java.lang.Thread
...
sleep()
...
EXCEPTIONS
IllegalArgumentException
If timeout < 0, or nanos < 0, or nanos > 999999
...
Failed JCK1.3 test is api/java_lang/Thread/sleep0104/sleep0104.html
---------------------------- test.java -------------------------
class test {
public static void main(String s[]) throws Throwable {
Thread.sleep(-1);
}
}
======================================================================
======================================================================