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

(reflect) unexpected cause for TypeNotPresentException

    XMLWordPrintable

Details

    • b38
    • generic
    • generic
    • Verified

    Description



      Name: viR10068 Date: 01/22/2004


      The API spec for the java.lang.TypeNotPresentException says:
      "public TypeNotPresentException(String typeName, Throwable cause)

          Constructs a TypeNotPresentException for the named type with the specified cause.

      Parameters:
      typeName - the fully qualified name of the unavailable type
      cause - the exception that was thrown when the system attempted to load the
      named type, or null if unavailable or inapplicable"

      But RI always return 'null' instead of actual cause.

      The affected test is:
      api/java_lang/TypeNotPresentException/index.html#TypeNotPresentException[TypeNotPresentExc
      eption0001]

      Source code:
      ---------------------- B.java -------------------------------
      import java.io.PrintStream;
      class B {
          public static void main(String args[]) {
              Throwable cause = new Throwable("because");
              Throwable par = new Throwable(cause);
              TypeNotPresentException cnp = new TypeNotPresentException("test", par);
          
              try {
                  throw cnp;
              } catch (TypeNotPresentException e) {
                  System.out.println("Expected cause is " + par.getCause());
                  System.out.println("cause is " + e.getCause());
              }
          }
      }
      -------------------------------------------------------------

      Execution log:
      % jdk1.5.0-b32b/solaris-sparc/bin/javac -source 1.5 -target 1.5 B.java &&
      jdk1.5.0-b32b/solaris-sparc/bin/java -Xfuture -showversion B
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32b)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b32b, mixed mode)

      Expected cause is java.lang.Throwable: because
      cause is null
      % jdk1.5.0-b35/solaris-sparc/bin/javac -source 1.5 -target 1.5 B.java &&
      jdk1.5.0-b35/solaris-sparc/bin/java -Xfuture -showversion B
      java version "1.5.0-beta2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b35)
      Java HotSpot(TM) Client VM (build 1.5.0-beta2-b35, mixed mode)

      Expected cause is java.lang.Throwable: because
      cause is null
      %

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

      Attachments

        Activity

          People

            darcy Joe Darcy
            vivsunw Viv Viv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: