Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4261233

sleep(-1) behavior is changed under HotSpot

XMLWordPrintable

    • kestrel
    • x86
    • windows_nt



      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);
        }
      }

      ======================================================================

      ======================================================================

            rschmidtsunw Rene Schmidt (Inactive)
            dkhukhrosunw Dmitry Khukhro (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: