< prev index next >

test/hotspot/jtreg/runtime/exceptionMsgs/NullPointerException/NullPointerExceptionTest.java

Print this page
rev 56281 : 8218628: Add detailed message to NullPointerException describing what is null.
Summary: This is the implementation of JEP 358: Helpful NullPointerExceptions.
Reviewed-by: coleenp
rev 56283 : [mq]: fixes_review_of_16.patch

@@ -25,10 +25,11 @@
 /**
  * @test
  * @summary Test extended NullPointerException message for
  *   classfiles generated with debug information. In this case the name
  *   of the variable containing the array is printed.
+ * @bug 8218628
  * @modules java.base/java.lang:open
  *          java.base/jdk.internal.org.objectweb.asm
  * @library /test/lib
  * @compile -g NullPointerExceptionTest.java
  * @run main/othervm -XX:MaxJavaStackTraceDepth=1 -XX:+ShowCodeDetailsInExceptionMessages NullPointerExceptionTest hasDebugInfo

@@ -36,10 +37,11 @@
 /**
  * @test
  * @summary Test extended NullPointerException message for class
  *   files generated without debugging information. The message lists
  *   detailed information about the entity that is null.
+ * @bug 8218628
  * @modules java.base/java.lang:open
  *          java.base/jdk.internal.org.objectweb.asm
  * @library /test/lib
  * @compile NullPointerExceptionTest.java
  * @run main/othervm -XX:MaxJavaStackTraceDepth=1 -XX:+ShowCodeDetailsInExceptionMessages NullPointerExceptionTest

@@ -85,16 +87,14 @@
         staticArray[0][0] = new int[1][];
     }
 
     public static void checkMessage(Throwable t, String expression,
                                     String obtainedMsg, String expectedMsg) {
-        //System.out.println("  thrown msg: " + obtainedMsg);
         System.out.println("\nSource code:\n  " + expression + "\n\nOutput:");
         t.printStackTrace(System.out);
         if (obtainedMsg != expectedMsg && // E.g. both are null.
             !obtainedMsg.equals(expectedMsg)) {
-            // GL: need to fix the test cases!
             System.out.println("expected msg: " + expectedMsg);
             Asserts.assertEquals(expectedMsg, obtainedMsg);
         }
         System.out.println("\n----");
     }
< prev index next >