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

(thread) Thread.getStrackTrace() returns different results on jdk5.0 and jdk6

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 6
    • core-libs
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0"
      Java(TM) SE Runtime Environment (build 1.6.0-b105)
      Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

      and

      java version "1.5.0_06"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
      Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      MS Windows XP SP 2

      A DESCRIPTION OF THE PROBLEM :
      The method Thread.getStackTrace() returns different results when executed on JDK 1.5 and JDK 1.6.

      on JDK1.6 the stacktrace starts with the element
      [0] "java.lang.Thread.getStackTrace(Thread.java:1426)"
      ...

      on JDK1.5 the stacktrace starts with a different element
      [0] "java.lang.Thread.dumpThreads(Native Method)"
      [1] "java.lang.Thread.getStackTrace(Thread.java:1383)"
      ....

      I think the problem is introduced with the lines

      // Don't need JVM help for current thread
      return (new Exception()).getStackTrace();

      that are new in JDK 1.6 version of Thread.getStackTrace(). Seems like Throwable.getStackTrace() and dumpThreads return different results.

      REPRODUCIBILITY :
      This bug can be reproduced always.

            psoper Pete Soper (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: