2019/9/24 1:13:14 -0700, goetz.lindenma...@sap.com:
> http://cr.openjdk.java.net/~goetz/wr19/8218628-exMsg-NPE/19/

This is very nice work!  I especially appreciate the thorough tests.

Looking at the tests, and the details of the JEP, I noticed that the
generated messages all end in a period (e.g., “... is null.”).  This
is pretty unusual in the JDK and jarring to the eye, except in the
rare cases in which an exception message is composed of multiple
distinct sentences.  I’m surprised that no one noticed this before.

As a data point, of the 17,999 messages that I was able to find in
invocations of exception constructors in the JDK 14 library code just
now, only 998 of them end in periods.  (I didn’t look at HotSpot, which
is trickier to grep for such things.)

So, I suggest you drop the trailing periods.

I also noticed that the generated messages use single quotes (‘'’) to
quote the names of fields, etc., rather than double quotes (‘"’).

On this choice, our corpus is less instructive: Of the 17,999 messages
I gathered, 446 of them use quotes of some sort, 227 of those use double
quotes, and 219 use single quotes.

Even so, I’ll propose here that double quotes are preferable: They’re
consistent with the Java language itself, they’re consistent with common
usage in both American and British English, and they’re less apt to be
confused with single quotes used as apostrophes (e.g., "MemoryHandler
can't load handler target \"" + targetName + "\"").

So, I also suggest that you change the single quotes to double quotes.

Fortunately, and because you have such good tests, this is pretty easy
to do.  Attached is a patch against your patch that makes these changes,
and after which all the tests still pass.

- Mark
# HG changeset patch
# User mr
# Date 1569968713 25200
#      Tue Oct 01 15:25:13 2019 -0700
# Node ID d7d49b8c3c44c527c1b60a590228259c02377738
# Parent  06c12a39584c579e9b9cd9d6bbba01a88b9ff764
Remove periods, and double quotes, for 8218628

diff --git a/src/hotspot/share/interpreter/bytecodeUtils.cpp b/src/hotspot/share/interpreter/bytecodeUtils.cpp
--- a/src/hotspot/share/interpreter/bytecodeUtils.cpp
+++ b/src/hotspot/share/interpreter/bytecodeUtils.cpp
@@ -1168,8 +1168,8 @@
 }
 
 bool ExceptionMessageBuilder::print_NPE_cause(outputStream* os, int bci, int slot) {
-  if (print_NPE_cause0(os, bci, slot, _max_cause_detail, false, " because '")) {
-    os->print("' is null.");
+  if (print_NPE_cause0(os, bci, slot, _max_cause_detail, false, " because \"")) {
+    os->print("\" is null");
     return true;
   }
   return false;
@@ -1346,7 +1346,7 @@
     case Bytecodes::_invokeinterface: {
       int cp_index = Bytes::get_native_u2(code_base + pos) DEBUG_ONLY(+ ConstantPool::CPCACHE_INDEX_TAG);
       if (max_detail == _max_cause_detail && !inner_expr) {
-        os->print(" because the return value of '");
+        os->print(" because the return value of \"");
       }
       print_method_name(os, _method, cp_index);
       return true;
@@ -1417,19 +1417,19 @@
         int name_and_type_index = cp->name_and_type_ref_index_at(cp_index);
         int name_index = cp->name_ref_index_at(name_and_type_index);
         Symbol* name = cp->symbol_at(name_index);
-        os->print("Cannot read field '%s'", name->as_C_string());
+        os->print("Cannot read field \"%s\"", name->as_C_string());
       } break;
     case Bytecodes::_putfield: {
         int cp_index = Bytes::get_native_u2(code_base + pos) DEBUG_ONLY(+ ConstantPool::CPCACHE_INDEX_TAG);
-        os->print("Cannot assign field '%s'", get_field_name(_method, cp_index));
+        os->print("Cannot assign field \"%s\"", get_field_name(_method, cp_index));
       } break;
     case Bytecodes::_invokevirtual:
     case Bytecodes::_invokespecial:
     case Bytecodes::_invokeinterface: {
         int cp_index = Bytes::get_native_u2(code_base+ pos) DEBUG_ONLY(+ ConstantPool::CPCACHE_INDEX_TAG);
-        os->print("Cannot invoke '");
+        os->print("Cannot invoke \"");
         print_method_name(os, _method, cp_index);
-        os->print("'");
+        os->print("\"");
       } break;
 
     default:
@@ -1474,7 +1474,6 @@
     if (!emb.print_NPE_cause(ss, bci, slot)) {
       // Nothing was printed. End the sentence without the 'because'
       // subordinate sentence.
-      ss->print(".");
     }
   }
   return true;
diff --git a/test/hotspot/jtreg/runtime/exceptionMsgs/NullPointerException/NPEInHiddenTopFrameTest.java b/test/hotspot/jtreg/runtime/exceptionMsgs/NullPointerException/NPEInHiddenTopFrameTest.java
--- a/test/hotspot/jtreg/runtime/exceptionMsgs/NullPointerException/NPEInHiddenTopFrameTest.java
+++ b/test/hotspot/jtreg/runtime/exceptionMsgs/NullPointerException/NPEInHiddenTopFrameTest.java
@@ -77,7 +77,7 @@
                          null :
                          // This is the correct message, but it describes code generated on-the-fly.
                          // You get it if you disable hiding frames (-XX:+ShowHiddenframes).
-                         "Cannot invoke 'String.concat(String)' because '<parameter1>' is null." );
+                         "Cannot invoke \"String.concat(String)\" because \"<parameter1>\" is null" );
             e.printStackTrace();
         }
     }
diff --git a/test/hotspot/jtreg/runtime/exceptionMsgs/NullPointerException/NullPointerExceptionTest.java b/test/hotspot/jtreg/runtime/exceptionMsgs/NullPointerException/NullPointerExceptionTest.java
--- a/test/hotspot/jtreg/runtime/exceptionMsgs/NullPointerException/NullPointerExceptionTest.java
+++ b/test/hotspot/jtreg/runtime/exceptionMsgs/NullPointerException/NullPointerExceptionTest.java
@@ -183,7 +183,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "int val = ia1[0];", e.getMessage(),
                          "Cannot load from int array because " +
-                         (hasDebugInfo ? "'ia1'" : "'<local1>'") + " is null.");
+                         (hasDebugInfo ? "\"ia1\"" : "\"<local1>\"") + " is null");
         }
         // faload
         try {
@@ -193,7 +193,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "float val = fa1[0];", e.getMessage(),
                          "Cannot load from float array because " +
-                         (hasDebugInfo ? "'fa1'" : "'<local2>'") + " is null.");
+                         (hasDebugInfo ? "\"fa1\"" : "\"<local2>\"") + " is null");
         }
         // aaload
         try {
@@ -203,7 +203,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "Object val = oa1[0];", e.getMessage(),
                          "Cannot load from object array because " +
-                         (hasDebugInfo ? "'oa1'" : "'<local3>'") + " is null.");
+                         (hasDebugInfo ? "\"oa1\"" : "\"<local3>\"") + " is null");
         }
         // baload (boolean)
         try {
@@ -213,7 +213,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "boolean val = za1[0];", e.getMessage(),
                          "Cannot load from byte/boolean array because " +
-                         (hasDebugInfo ? "'za1'" : "'<local4>'") + " is null.");
+                         (hasDebugInfo ? "\"za1\"" : "\"<local4>\"") + " is null");
         }
         // baload (byte)
         try {
@@ -223,7 +223,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "byte val = ba1[0];", e.getMessage(),
                          "Cannot load from byte/boolean array because " +
-                         (hasDebugInfo ? "'ba1'" : "'<local5>'") + " is null.");
+                         (hasDebugInfo ? "\"ba1\"" : "\"<local5>\"") + " is null");
         }
         // caload
         try {
@@ -233,7 +233,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "char val = ca1[0];", e.getMessage(),
                          "Cannot load from char array because " +
-                         (hasDebugInfo ? "'ca1'" : "'<local6>'") + " is null.");
+                         (hasDebugInfo ? "\"ca1\"" : "\"<local6>\"") + " is null");
         }
         // saload
         try {
@@ -243,7 +243,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "short val = sa1[0];", e.getMessage(),
                          "Cannot load from short array because " +
-                         (hasDebugInfo ? "'sa1'" : "'<local7>'") + " is null.");
+                         (hasDebugInfo ? "\"sa1\"" : "\"<local7>\"") + " is null");
         }
         // laload
         try {
@@ -253,7 +253,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "long val = la1[0];", e.getMessage(),
                          "Cannot load from long array because " +
-                         (hasDebugInfo ? "'la1'" : "'<local8>'") + " is null.");
+                         (hasDebugInfo ? "\"la1\"" : "\"<local8>\"") + " is null");
         }
         // daload
         try {
@@ -263,7 +263,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "double val = da1[0];", e.getMessage(),
                          "Cannot load from double array because " +
-                         (hasDebugInfo ? "'da1'" : "'<local9>'") + " is null.");
+                         (hasDebugInfo ? "\"da1\"" : "\"<local9>\"") + " is null");
         }
 
         // iastore
@@ -274,7 +274,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "ia1[0] = 0;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'ia1'" : "'<local1>'") + " is null.");
+                         (hasDebugInfo ? "\"ia1\"" : "\"<local1>\"") + " is null");
         }
         // fastore
         try {
@@ -284,7 +284,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "fa1[0] = 0.7f;", e.getMessage(),
                          "Cannot store to float array because " +
-                         (hasDebugInfo ? "'fa1'" : "'<local2>'") + " is null.");
+                         (hasDebugInfo ? "\"fa1\"" : "\"<local2>\"") + " is null");
         }
         // aastore
         try {
@@ -294,7 +294,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "oa1[0] = new Object();", e.getMessage(),
                          "Cannot store to object array because " +
-                         (hasDebugInfo ? "'oa1'" : "'<local3>'") + " is null.");
+                         (hasDebugInfo ? "\"oa1\"" : "\"<local3>\"") + " is null");
         }
         // bastore (boolean)
         try {
@@ -304,7 +304,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "za1[0] = false;", e.getMessage(),
                          "Cannot store to byte/boolean array because " +
-                         (hasDebugInfo ? "'za1'" : "'<local4>'") + " is null.");
+                         (hasDebugInfo ? "\"za1\"" : "\"<local4>\"") + " is null");
         }
         // bastore (byte)
         try {
@@ -314,7 +314,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "ba1[0] = 0;", e.getMessage(),
                          "Cannot store to byte/boolean array because " +
-                         (hasDebugInfo ? "'ba1'" : "'<local5>'") + " is null.");
+                         (hasDebugInfo ? "\"ba1\"" : "\"<local5>\"") + " is null");
         }
         // castore
         try {
@@ -324,7 +324,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "ca1[0] = 0;", e.getMessage(),
                          "Cannot store to char array because " +
-                         (hasDebugInfo ? "'ca1'" : "'<local6>'") + " is null.");
+                         (hasDebugInfo ? "\"ca1\"" : "\"<local6>\"") + " is null");
         }
         // sastore
         try {
@@ -334,7 +334,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "sa1[0] = 0;", e.getMessage(),
                          "Cannot store to short array because " +
-                         (hasDebugInfo ? "'sa1'" : "'<local7>'") + " is null.");
+                         (hasDebugInfo ? "\"sa1\"" : "\"<local7>\"") + " is null");
         }
         // lastore
         try {
@@ -344,7 +344,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "la1[0] = 0;", e.getMessage(),
                          "Cannot store to long array because " +
-                         (hasDebugInfo ? "'la1'" : "'<local8>'") + " is null.");
+                         (hasDebugInfo ? "\"la1\"" : "\"<local8>\"") + " is null");
         }
         // dastore
         try {
@@ -354,7 +354,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "da1[0] = 0;", e.getMessage(),
                          "Cannot store to double array because " +
-                         (hasDebugInfo ? "'da1'" : "'<local9>'") + " is null.");
+                         (hasDebugInfo ? "\"da1\"" : "\"<local9>\"") + " is null");
         }
 
         // arraylength
@@ -365,7 +365,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, " int val = za1.length;", e.getMessage(),
                          "Cannot read the array length because " +
-                         (hasDebugInfo ? "'za1'" : "'<local4>'") + " is null.");
+                         (hasDebugInfo ? "\"za1\"" : "\"<local4>\"") + " is null");
         }
         // athrow
         try {
@@ -374,7 +374,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "throw exc;", e.getMessage(),
                          "Cannot throw exception because " +
-                         (hasDebugInfo ? "'exc'" : "'<local10>'") + " is null.");
+                         (hasDebugInfo ? "\"exc\"" : "\"<local10>\"") + " is null");
         }
         // monitorenter
         try {
@@ -384,7 +384,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "synchronized (nullInstanceField) { ... }", e.getMessage(),
                          "Cannot enter synchronized block because " +
-                         "'this.nullInstanceField' is null.");
+                         "\"this.nullInstanceField\" is null");
         }
         // monitorexit
         // No test available
@@ -396,8 +396,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "Object val = nullInstanceField.nullInstanceField;", e.getMessage(),
-                         "Cannot read field 'nullInstanceField' because " +
-                         "'this.nullInstanceField' is null.");
+                         "Cannot read field \"nullInstanceField\" because " +
+                         "\"this.nullInstanceField\" is null");
         }
         // putfield
         try {
@@ -406,8 +406,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "nullInstanceField.nullInstanceField = new NullPointerExceptionTest();", e.getMessage(),
-                         "Cannot assign field 'nullInstanceField' because " +
-                         "'this.nullInstanceField' is null.");
+                         "Cannot assign field \"nullInstanceField\" because " +
+                         "\"this.nullInstanceField\" is null");
         }
         // invoke
         try {
@@ -416,8 +416,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "String val = nullInstanceField.toString();", e.getMessage(),
-                         "Cannot invoke 'Object.toString()' because " +
-                         "'this.nullInstanceField' is null.");
+                         "Cannot invoke \"Object.toString()\" because " +
+                         "\"this.nullInstanceField\" is null");
         }
         // Test parameter and return types
         try {
@@ -426,8 +426,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "boolean val = (nullInstanceField.callWithTypes(null, null, 0.0f, 0L, (short)0, false, (byte)0, 0.0, 'x') == 0.0);", e.getMessage(),
-                         "Cannot invoke 'NullPointerExceptionTest.callWithTypes(String[][], int[][][], float, long, short, boolean, byte, double, char)' because " +
-                         "'this.nullInstanceField' is null.");
+                         "Cannot invoke \"NullPointerExceptionTest.callWithTypes(String[][], int[][][], float, long, short, boolean, byte, double, char)\" because " +
+                         "\"this.nullInstanceField\" is null");
         }
     }
 
@@ -449,7 +449,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[i0][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[i0]'" : "'<local6>[<local0>]'") + " is null.");
+                         (hasDebugInfo ? "\"a[i0]\"" : "\"<local6>[<local0>]\"") + " is null");
         }
         // iload_1
         try {
@@ -458,7 +458,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[i1][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[i1]'" : "'<local6>[<local1>]'") + " is null.");
+                         (hasDebugInfo ? "\"a[i1]\"" : "\"<local6>[<local1>]\"") + " is null");
         }
         // iload_2
         try {
@@ -467,7 +467,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[i2][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[i2]'" : "'<local6>[<local2>]'") + " is null.");
+                         (hasDebugInfo ? "\"a[i2]\"" : "\"<local6>[<local2>]\"") + " is null");
         }
         // iload_3
         try {
@@ -476,7 +476,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[i3][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[i3]'" : "'<local6>[<local3>]'") + " is null.");
+                         (hasDebugInfo ? "\"a[i3]\"" : "\"<local6>[<local3>]\"") + " is null");
         }
         // iload
         try {
@@ -485,7 +485,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[i5][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[i5]'" : "'<local6>[<local5>]'") + " is null.");
+                         (hasDebugInfo ? "\"a[i5]\"" : "\"<local6>[<local5>]\"") + " is null");
         }
     }
 
@@ -511,7 +511,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[(int)long0][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[...]'" : "'<local12>[...]'") + " is null.");
+                         (hasDebugInfo ? "\"a[...]\"" : "\"<local12>[...]\"") + " is null");
         }
         // lload_1
         try {
@@ -520,7 +520,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[(int)long1][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[...]'" : "'<local12>[...]'") + " is null.");
+                         (hasDebugInfo ? "\"a[...]\"" : "\"<local12>[...]\"") + " is null");
         }
         // lload_2
         try {
@@ -529,7 +529,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[(int)long2][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[...]'" : "'<local12>[...]'") + " is null.");
+                         (hasDebugInfo ? "\"a[...]\"" : "\"<local12>[...]\"") + " is null");
         }
         // lload_3
         try {
@@ -538,7 +538,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[(int)long3][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[...]'" : "'<local12>[...]'") + " is null.");
+                         (hasDebugInfo ? "\"a[...]\"" : "\"<local12>[...]\"") + " is null");
         }
         // lload
         try {
@@ -547,7 +547,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[(int)long5][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[...]'" : "'<local12>[...]'") + " is null.");
+                         (hasDebugInfo ? "\"a[...]\"" : "\"<local12>[...]\"") + " is null");
         }
     }
 
@@ -569,7 +569,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[(int)f0][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[...]'" : "'<local6>[...]'") + " is null.");
+                         (hasDebugInfo ? "\"a[...]\"" : "\"<local6>[...]\"") + " is null");
         }
         // fload_1
         try {
@@ -578,7 +578,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[(int)f1][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[...]'" : "'<local6>[...]'") + " is null.");
+                         (hasDebugInfo ? "\"a[...]\"" : "\"<local6>[...]\"") + " is null");
         }
         // fload_2
         try {
@@ -587,7 +587,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[(int)f2][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[...]'" : "'<local6>[...]'") + " is null.");
+                         (hasDebugInfo ? "\"a[...]\"" : "\"<local6>[...]\"") + " is null");
         }
         // fload_3
         try {
@@ -596,7 +596,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[(int)f3][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[...]'" : "'<local6>[...]'") + " is null.");
+                         (hasDebugInfo ? "\"a[...]\"" : "\"<local6>[...]\"") + " is null");
         }
         // fload
         try {
@@ -605,7 +605,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[(int)f5][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[...]'" : "'<local6>[...]'") + " is null.");
+                         (hasDebugInfo ? "\"a[...]\"" : "\"<local6>[...]\"") + " is null");
         }
     }
 
@@ -625,8 +625,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "f0.i = 33;", e.getMessage(),
-                         "Cannot assign field 'i' because " +
-                         (hasDebugInfo ? "'f0'" : "'<local0>'") + " is null.");
+                         "Cannot assign field \"i\" because " +
+                         (hasDebugInfo ? "\"f0\"" : "\"<local0>\"") + " is null");
         }
         // aload_1
         try {
@@ -634,8 +634,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "f1.i = 33;", e.getMessage(),
-                         "Cannot assign field 'i' because " +
-                         (hasDebugInfo ? "'f1'" : "'<local1>'") + " is null.");
+                         "Cannot assign field \"i\" because " +
+                         (hasDebugInfo ? "\"f1\"" : "\"<local1>\"") + " is null");
         }
         // aload_2
         try {
@@ -643,8 +643,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "f2.i = 33;", e.getMessage(),
-                         "Cannot assign field 'i' because " +
-                         (hasDebugInfo ? "'f2'" : "'<local2>'") + " is null.");
+                         "Cannot assign field \"i\" because " +
+                         (hasDebugInfo ? "\"f2\"" : "\"<local2>\"") + " is null");
         }
         // aload_3
         try {
@@ -652,8 +652,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "f3.i = 33;", e.getMessage(),
-                         "Cannot assign field 'i' because " +
-                         (hasDebugInfo ? "'f3'" : "'<local3>'") + " is null.");
+                         "Cannot assign field \"i\" because " +
+                         (hasDebugInfo ? "\"f3\"" : "\"<local3>\"") + " is null");
         }
         // aload
         try {
@@ -661,8 +661,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "f5.i = 33;", e.getMessage(),
-                         "Cannot assign field 'i' because " +
-                         (hasDebugInfo ? "'f5'" : "'<local5>'") + " is null.");
+                         "Cannot assign field \"i\" because " +
+                         (hasDebugInfo ? "\"f5\"" : "\"<local5>\"") + " is null");
         }
     }
 
@@ -702,7 +702,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[0][0][0][0][0] = 99; // a is null", e.getMessage(),
                          "Cannot load from object array because " +
-                         (hasDebugInfo ? "'a'" : "'<local1>'") + " is null.");
+                         (hasDebugInfo ? "\"a\"" : "\"<local1>\"") + " is null");
         }
         a = new int[1][][][][][];
         try {
@@ -711,7 +711,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[0][0][0][0][0] = 99; // a[0] is null", e.getMessage(),
                          "Cannot load from object array because " +
-                         (hasDebugInfo ? "'a[0]'" : "'<local1>[0]'") + " is null.");
+                         (hasDebugInfo ? "\"a[0]\"" : "\"<local1>[0]\"") + " is null");
         }
         a[0] = new int[1][][][][];
         try {
@@ -720,7 +720,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[0][0][0][0][0] = 99; // a[0][0] is null", e.getMessage(),
                          "Cannot load from object array because " +
-                         (hasDebugInfo ? "'a[0][0]'" : "'<local1>[0][0]'") + " is null.");
+                         (hasDebugInfo ? "\"a[0][0]\"" : "\"<local1>[0][0]\"") + " is null");
         }
         a[0][0] = new int[1][][][];
         try {
@@ -729,7 +729,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[0][0][0][0][0] = 99; // a[0][0][0] is null", e.getMessage(),
                          "Cannot load from object array because " +
-                         (hasDebugInfo ? "'a[0][0][0]'" : "'<local1>[0][0][0]'") + " is null.");
+                         (hasDebugInfo ? "\"a[0][0][0]\"" : "\"<local1>[0][0][0]\"") + " is null");
         }
         try {
             System.out.println(a[0][0][0].length);
@@ -737,7 +737,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[0][0][0].length; // a[0][0][0] is null", e.getMessage(),
                          "Cannot read the array length because " +
-                         (hasDebugInfo ? "'a[0][0][0]'" : "'<local1>[0][0][0]'") + " is null.");
+                         (hasDebugInfo ? "\"a[0][0][0]\"" : "\"<local1>[0][0][0]\"") + " is null");
         }
         a[0][0][0] = new int[1][][];
         try {
@@ -746,7 +746,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[0][0][0][0][0] = 99; // a[0][0][0][0] is null", e.getMessage(),
                          "Cannot load from object array because " +
-                         (hasDebugInfo ? "'a[0][0][0][0]'" : "'<local1>[0][0][0][0]'") + " is null.");
+                         (hasDebugInfo ? "\"a[0][0][0][0]\"" : "\"<local1>[0][0][0][0]\"") + " is null");
         }
         a[0][0][0][0] = new int[1][];
         // Reaching max recursion depth. Prints <array>.
@@ -756,7 +756,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[0][0][0][0][0] = 99; // a[0][0][0][0][0] is null", e.getMessage(),
                          "Cannot store to int array because " +
-                         "'<array>[0][0][0][0][0]' is null.");
+                         "\"<array>[0][0][0][0][0]\" is null");
         }
         a[0][0][0][0][0] = new int[1];
         try {
@@ -774,8 +774,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "a.to_b.to_c.to_d.num = 99; // a is null", e.getMessage(),
-                         "Cannot read field 'to_b' because " +
-                         (hasDebugInfo ? "'a'" : "'<local1>'") + " is null.");
+                         "Cannot read field \"to_b\" because " +
+                         (hasDebugInfo ? "\"a\"" : "\"<local1>\"") + " is null");
         }
         a = new A();
         try {
@@ -783,8 +783,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "a.to_b.to_c.to_d.num = 99; // a.to_b is null", e.getMessage(),
-                         "Cannot read field 'to_c' because " +
-                         (hasDebugInfo ? "'a.to_b'" : "'<local1>.to_b'") + " is null.");
+                         "Cannot read field \"to_c\" because " +
+                         (hasDebugInfo ? "\"a.to_b\"" : "\"<local1>.to_b\"") + " is null");
         }
         a.to_b = new B();
         try {
@@ -792,8 +792,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "a.to_b.to_c.to_d.num = 99; // a.to_b.to_c is null", e.getMessage(),
-                         "Cannot read field 'to_d' because " +
-                         (hasDebugInfo ? "'a.to_b.to_c'" : "'<local1>.to_b.to_c'") + " is null.");
+                         "Cannot read field \"to_d\" because " +
+                         (hasDebugInfo ? "\"a.to_b.to_c\"" : "\"<local1>.to_b.to_c\"") + " is null");
         }
         a.to_b.to_c = new C();
         try {
@@ -801,8 +801,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "a.to_b.to_c.to_d.num = 99; // a.to_b.to_c.to_d is null", e.getMessage(),
-                         "Cannot assign field 'num' because " +
-                         (hasDebugInfo ? "'a.to_b.to_c.to_d'" : "'<local1>.to_b.to_c.to_d'") + " is null.");
+                         "Cannot assign field \"num\" because " +
+                         (hasDebugInfo ? "\"a.to_b.to_c.to_d\"" : "\"<local1>.to_b.to_c.to_d\"") + " is null");
         }
     }
 
@@ -814,8 +814,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "a.getB().getBfromB().getC().getD().num = 99; // a is null", e.getMessage(),
-                         "Cannot invoke 'NullPointerExceptionTest$A.getB()' because " +
-                         (hasDebugInfo ? "'a" : "'<local1>") + "' is null.");
+                         "Cannot invoke \"NullPointerExceptionTest$A.getB()\" because " +
+                         (hasDebugInfo ? "\"a" : "\"<local1>") + "\" is null");
         }
         a = new A();
         try {
@@ -823,8 +823,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "a.getB().getBfromB().getC().getD().num = 99; // a.getB() is null", e.getMessage(),
-                         "Cannot invoke 'NullPointerExceptionTest$B.getBfromB()' because " +
-                         "the return value of 'NullPointerExceptionTest$A.getB()' is null.");
+                         "Cannot invoke \"NullPointerExceptionTest$B.getBfromB()\" because " +
+                         "the return value of \"NullPointerExceptionTest$A.getB()\" is null");
         }
         a.to_b = new B();
         try {
@@ -832,8 +832,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "a.getB().getBfromB().getC().getD().num = 99; // a.getB().getBfromB() is null", e.getMessage(),
-                         "Cannot invoke 'NullPointerExceptionTest$B.getC()' because " +
-                         "the return value of 'NullPointerExceptionTest$B.getBfromB()' is null.");
+                         "Cannot invoke \"NullPointerExceptionTest$B.getC()\" because " +
+                         "the return value of \"NullPointerExceptionTest$B.getBfromB()\" is null");
         }
         a.to_b.to_b = new B();
         try {
@@ -841,8 +841,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "a.getB().getBfromB().getC().getD().num = 99; // a.getB().getBfromB().getC() is null", e.getMessage(),
-                         "Cannot invoke 'NullPointerExceptionTest$C.getD()' because " +
-                         "the return value of 'NullPointerExceptionTest$B.getC()' is null.");
+                         "Cannot invoke \"NullPointerExceptionTest$C.getD()\" because " +
+                         "the return value of \"NullPointerExceptionTest$B.getC()\" is null");
         }
         a.to_b.to_b.to_c = new C();
         try {
@@ -850,8 +850,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "a.getB().getBfromB().getC().getD().num = 99; // a.getB().getBfromB().getC().getD() is null", e.getMessage(),
-                         "Cannot assign field 'num' because " +
-                         "the return value of 'NullPointerExceptionTest$C.getD()' is null.");
+                         "Cannot assign field \"num\" because " +
+                         "the return value of \"NullPointerExceptionTest$C.getD()\" is null");
         }
     }
 
@@ -863,8 +863,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; // a is null", e.getMessage(),
-                         "Cannot invoke 'NullPointerExceptionTest$A.getB()' because " +
-                         (hasDebugInfo ? "'a'" : "'<local1>'") + " is null.");
+                         "Cannot invoke \"NullPointerExceptionTest$A.getB()\" because " +
+                         (hasDebugInfo ? "\"a\"" : "\"<local1>\"") + " is null");
         }
         a = new A();
         try {
@@ -872,8 +872,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; // a.getB() is null", e.getMessage(),
-                         "Cannot invoke 'NullPointerExceptionTest$B.getBfromB()' because " +
-                         "the return value of 'NullPointerExceptionTest$A.getB()' is null.");
+                         "Cannot invoke \"NullPointerExceptionTest$B.getBfromB()\" because " +
+                         "the return value of \"NullPointerExceptionTest$A.getB()\" is null");
         }
         a.to_b = new B();
         try {
@@ -881,8 +881,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; // a.getB().getBfromB() is null", e.getMessage(),
-                         "Cannot read field 'to_c' because " +
-                         "the return value of 'NullPointerExceptionTest$B.getBfromB()' is null.");
+                         "Cannot read field \"to_c\" because " +
+                         "the return value of \"NullPointerExceptionTest$B.getBfromB()\" is null");
         }
         a.to_b.to_b = new B();
         try {
@@ -890,8 +890,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; // a.getB().getBfromB().to_c is null", e.getMessage(),
-                         "Cannot read field 'to_d' because " +
-                         "'NullPointerExceptionTest$B.getBfromB().to_c' is null.");
+                         "Cannot read field \"to_d\" because " +
+                         "\"NullPointerExceptionTest$B.getBfromB().to_c\" is null");
         }
         a.to_b.to_b.to_c = new C();
         try {
@@ -899,8 +899,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; // a.getB().getBfromB().to_c.to_d is null", e.getMessage(),
-                         "Cannot read field 'ar' because " +
-                         "'NullPointerExceptionTest$B.getBfromB().to_c.to_d' is null.");
+                         "Cannot read field \"ar\" because " +
+                         "\"NullPointerExceptionTest$B.getBfromB().to_c.to_d\" is null");
         }
         a.to_b.to_b.to_c.to_d = new D();
         try {
@@ -909,7 +909,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; // a.getB().getBfromB().to_c.to_d.ar is null", e.getMessage(),
                          "Cannot load from object array because " +
-                         "'NullPointerExceptionTest$B.getBfromB().to_c.to_d.ar' is null.");
+                         "\"NullPointerExceptionTest$B.getBfromB().to_c.to_d.ar\" is null");
         }
         try {
             a.getB().getBfromB().getC().getD().ar[0][0] = 99;
@@ -917,7 +917,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a.getB().getBfromB().getC().getD().ar[0][0] = 99; // a.getB().getBfromB().getC().getD().ar is null", e.getMessage(),
                          "Cannot load from object array because " +
-                         "'NullPointerExceptionTest$C.getD().ar' is null.");
+                         "\"NullPointerExceptionTest$C.getD().ar\" is null");
         }
         a.to_b.to_b.to_c.to_d.ar = new int[1][];
         try {
@@ -926,7 +926,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a.getB().getBfromB().to_c.to_d.ar[0][0] = 99; // a.getB().getBfromB().to_c.to_d.ar[0] is null", e.getMessage(),
                          "Cannot store to int array because " +
-                         "'NullPointerExceptionTest$B.getBfromB().to_c.to_d.ar[0]' is null.");
+                         "\"NullPointerExceptionTest$B.getBfromB().to_c.to_d.ar[0]\" is null");
         }
         try {
             a.getB().getBfromB().getC().getD().ar[0][0] = 99;
@@ -934,7 +934,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a.getB().getBfromB().getC().getD().ar[0][0] = 99; // a.getB().getBfromB().getC().getD().ar[0] is null", e.getMessage(),
                          "Cannot store to int array because " +
-                         "'NullPointerExceptionTest$C.getD().ar[0]' is null.");
+                         "\"NullPointerExceptionTest$C.getD().ar[0]\" is null");
         }
     }
 
@@ -980,7 +980,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "(gen.getArray())[0] = 1.0;", e.getMessage(),
                          "Cannot store to double array because " +
-                         "the return value of 'NullPointerExceptionTest$DoubleArrayGen.getArray()' is null.");
+                         "the return value of \"NullPointerExceptionTest$DoubleArrayGen.getArray()\" is null");
         }
     }
 
@@ -998,7 +998,7 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "this.nullInstanceField.nullInstanceField = new NullPointerExceptionTest();", e.getMessage(),
-                         "Cannot assign field 'nullInstanceField' because 'this.nullInstanceField' is null.");
+                         "Cannot assign field \"nullInstanceField\" because \"this.nullInstanceField\" is null");
         }
 
         // aconst_null
@@ -1006,7 +1006,7 @@
             throw null;
         } catch (NullPointerException e) {
             checkMessage(e, "throw null;", e.getMessage(),
-                         "Cannot throw exception because 'null' is null.");
+                         "Cannot throw exception because \"null\" is null");
         }
         // iconst_0
         try {
@@ -1015,7 +1015,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[0][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[0]'" : "'<local1>[0]'") + " is null.");
+                         (hasDebugInfo ? "\"a[0]\"" : "\"<local1>[0]\"") + " is null");
         }
         // iconst_1
         try {
@@ -1024,7 +1024,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[1][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[1]'" : "'<local1>[1]'") + " is null.");
+                         (hasDebugInfo ? "\"a[1]\"" : "\"<local1>[1]\"") + " is null");
         }
         // iconst_2
         try {
@@ -1033,7 +1033,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[2][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[2]'" : "'<local1>[2]'") + " is null.");
+                         (hasDebugInfo ? "\"a[2]\"" : "\"<local1>[2]\"") + " is null");
         }
         // iconst_3
         try {
@@ -1042,7 +1042,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[3][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[3]'" : "'<local1>[3]'") + " is null.");
+                         (hasDebugInfo ? "\"a[3]\"" : "\"<local1>[3]\"") + " is null");
         }
         // iconst_4
         try {
@@ -1051,7 +1051,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[4][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[4]'" : "'<local1>[4]'") + " is null.");
+                         (hasDebugInfo ? "\"a[4]\"" : "\"<local1>[4]\"") + " is null");
         }
         // iconst_5
         try {
@@ -1060,7 +1060,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[5][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[5]'" : "'<local1>[5]'") + " is null.");
+                         (hasDebugInfo ? "\"a[5]\"" : "\"<local1>[5]\"") + " is null");
         }
         // long --> iconst
         try {
@@ -1069,7 +1069,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[(int)0L][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[0]'" : "'<local1>[0]'") + " is null.");
+                         (hasDebugInfo ? "\"a[0]\"" : "\"<local1>[0]\"") + " is null");
         }
         // bipush
         try {
@@ -1078,7 +1078,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[139][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[139]'" : "'<local1>[139]'") + " is null.");
+                         (hasDebugInfo ? "\"a[139]\"" : "\"<local1>[139]\"") + " is null");
         }
         // sipush
         try {
@@ -1087,7 +1087,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "a[819][0] = 77;", e.getMessage(),
                          "Cannot store to int array because " +
-                         (hasDebugInfo ? "'a[819]'" : "'<local1>[819]'") + " is null.");
+                         (hasDebugInfo ? "\"a[819]\"" : "\"<local1>[819]\"") + " is null");
         }
 
         // aaload, with recursive descend.
@@ -1100,7 +1100,7 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "boolean val = (((float[]) nullStaticField)[0] == 1.0f);", e.getMessage(),
-                         "Cannot load from float array because 'NullPointerExceptionTest.nullStaticField' is null.");
+                         "Cannot load from float array because \"NullPointerExceptionTest.nullStaticField\" is null");
         }
 
         // getfield, with recursive descend.
@@ -1114,7 +1114,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "char val = ((char[]) NullPointerGenerator.nullReturner(false))[0];", e.getMessage(),
                          "Cannot load from char array because " +
-                         "the return value of 'NullPointerExceptionTest$NullPointerGenerator.nullReturner(boolean)' is null.");
+                         "the return value of \"NullPointerExceptionTest$NullPointerGenerator.nullReturner(boolean)\" is null");
         }
         // invokevirtual
         try {
@@ -1124,7 +1124,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "char val = ((char[]) (new NullPointerGenerator().returnMyNull(1, 1, (short) 1)))[0];", e.getMessage(),
                          "Cannot load from char array because " +
-                         "the return value of 'NullPointerExceptionTest$NullPointerGenerator.returnMyNull(double, long, short)' is null.");
+                         "the return value of \"NullPointerExceptionTest$NullPointerGenerator.returnMyNull(double, long, short)\" is null");
         }
         // Call with array arguments.
         try {
@@ -1134,7 +1134,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "double val = ((double[]) returnNull(null, null, 1f))[0];", e.getMessage(),
                          "Cannot load from double array because " +
-                         "the return value of 'NullPointerExceptionTest.returnNull(String[][], int[][][], float)' is null.");
+                         "the return value of \"NullPointerExceptionTest.returnNull(String[][], int[][][], float)\" is null");
         }
         // invokeinterface
         ImplTestLoadedFromMethod(new DoubleArrayGenImpl());
@@ -1143,8 +1143,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "returnMeAsNull(null, 1, 'A').dag = new DoubleArrayGenImpl();", e.getMessage(),
-                         "Cannot assign field 'dag' because " +
-                         "the return value of 'NullPointerExceptionTest.returnMeAsNull(java.lang.Throwable, int, char)' is null.");
+                         "Cannot assign field \"dag\" because " +
+                         "the return value of \"NullPointerExceptionTest.returnMeAsNull(java.lang.Throwable, int, char)\" is null");
         }
         testMethodChasing();
 
@@ -1159,8 +1159,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "a.to_b.to_c.to_d.num = 99; // to_c is null, a is a parameter.", e.getMessage(),
-                         "Cannot read field 'to_d' because '" +
-                         (hasDebugInfo ? "a" : "<parameter1>") + ".to_b.to_c' is null.");
+                         "Cannot read field \"to_d\" because \"" +
+                         (hasDebugInfo ? "a" : "<parameter1>") + ".to_b.to_c\" is null");
         }
 
         try {
@@ -1168,9 +1168,9 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "b.to_c.to_d.num = 99; // b is null and b is a parameter.", e.getMessage(),
-                         "Cannot read field 'to_c' because " +
+                         "Cannot read field \"to_c\" because " +
                          // We expect number '3' for the parameter.
-                         (hasDebugInfo ? "'b'" : "'<parameter3>'") + " is null.");
+                         (hasDebugInfo ? "\"b\"" : "\"<parameter3>\"") + " is null");
         }
 
 
@@ -1179,8 +1179,8 @@
             int my_i = i;
         }  catch (NullPointerException e) {
             checkMessage(e, "int my_i = i; // i is a parameter of type Integer.",  e.getMessage(),
-                         "Cannot invoke 'java.lang.Integer.intValue()' because " +
-                         (hasDebugInfo ? "'i'" : "'<parameter4>'") + " is null.");
+                         "Cannot invoke \"java.lang.Integer.intValue()\" because " +
+                         (hasDebugInfo ? "\"i\"" : "\"<parameter4>\"") + " is null");
         }
     }
 
@@ -1195,7 +1195,7 @@
     public void testCreation() throws Exception {
         // If allocated with new, the message should not be generated.
         Asserts.assertNull(new NullPointerException().getMessage());
-        String msg = new String("A pointless message.");
+        String msg = new String("A pointless message");
         Asserts.assertTrue(new NullPointerException(msg).getMessage() == msg);
 
         // If created via reflection, the message should not be generated.
@@ -1220,8 +1220,8 @@
     public void testSameMessage() throws Exception {
         Object null_o = null;
         String expectedMsg =
-            "Cannot invoke 'Object.hashCode()' because " +
-            (hasDebugInfo ? "'null_o" : "'<local1>") + "' is null.";
+            "Cannot invoke \"Object.hashCode()\" because " +
+            (hasDebugInfo ? "\"null_o" : "\"<local1>") + "\" is null";
 
         try {
             null_o.hashCode();
@@ -1273,8 +1273,8 @@
             o3 = npe3;
             msg3 = npe3.getMessage();
             checkMessage(npe3, "int hc = null_o3.hashCode();", msg3,
-                         "Cannot invoke 'Object.hashCode()' because " +
-                         (hasDebugInfo ? "'null_o3'" : "'<local14>'") + " is null.");
+                         "Cannot invoke \"Object.hashCode()\" because " +
+                         (hasDebugInfo ? "\"null_o3\"" : "\"<local14>\"") + " is null");
         }
         ByteArrayOutputStream bos3 = new ByteArrayOutputStream();
         ObjectOutputStream oos3 = new ObjectOutputStream(bos3);
@@ -1300,7 +1300,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "staticLongArray[0][0] = 2L;", e.getMessage(),
                          "Cannot store to long array because " +
-                         "'NullPointerExceptionTest.staticLongArray[0]' is null.");
+                         "\"NullPointerExceptionTest.staticLongArray[0]\" is null");
         }
 
         try {
@@ -1310,8 +1310,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "Object val = obj.dag.getArray().clone();", e.getMessage(),
-                         "Cannot invoke 'NullPointerExceptionTest$DoubleArrayGen.getArray()' because " +
-                         (hasDebugInfo ? "'obj" : "'<local1>") + ".dag' is null.");
+                         "Cannot invoke \"NullPointerExceptionTest$DoubleArrayGen.getArray()\" because " +
+                         (hasDebugInfo ? "\"obj" : "\"<local1>") + ".dag\" is null");
         }
         try {
             int indexes[] = new int[1];
@@ -1321,8 +1321,8 @@
             Asserts.fail();
         } catch (NullPointerException e) {
             checkMessage(e, "Object val = objs[indexes[0]].nullInstanceField.returnNull(null, null, 1f);", e.getMessage(),
-                         "Cannot invoke 'NullPointerExceptionTest.returnNull(String[][], int[][][], float)' because " +
-                         (hasDebugInfo ? "'objs[indexes" : "'<local2>[<local1>") + "[0]].nullInstanceField' is null.");
+                         "Cannot invoke \"NullPointerExceptionTest.returnNull(String[][], int[][][], float)\" because " +
+                         (hasDebugInfo ? "\"objs[indexes" : "\"<local2>[<local1>") + "[0]].nullInstanceField\" is null");
         }
 
         try {
@@ -1335,7 +1335,7 @@
         } catch (NullPointerException e) {
             checkMessage(e, "synchronized (objs[indexes[0]][0].nullInstanceField) { ... }", e.getMessage(),
                          "Cannot enter synchronized block because " +
-                         (hasDebugInfo ? "'objs[indexes" : "'<local2>[<local1>" ) + "[0]][0].nullInstanceField' is null.");
+                         (hasDebugInfo ? "\"objs[indexes" : "\"<local2>[<local1>" ) + "[0]][0].nullInstanceField\" is null");
         }
 
         try {
@@ -1346,7 +1346,7 @@
             byte[] val = (Math.random() < 0.5 ? s : (new String[1])[0]).getBytes();
         } catch (NullPointerException e) {
             checkMessage(e, "byte[] val = (Math.random() < 0.5 ? s : (new String[1])[0]).getBytes();", e.getMessage(),
-                         "Cannot invoke 'String.getBytes()'.");
+                         "Cannot invoke \"String.getBytes()\"");
         }
 
         try {
@@ -1360,7 +1360,7 @@
             int val = (Math.random() < 0.5 ? a[(int)index] : b[(int)index])[13];
         } catch (NullPointerException e) {
             checkMessage(e, "int val = (Math.random() < 0.5 ? a[(int)index] : b[(int)index])[13]", e.getMessage(),
-                         "Cannot load from int array.");
+                         "Cannot load from int array");
         }
 
         try {
@@ -1373,7 +1373,7 @@
             int val = (Math.random() < 0.5 ? a : b)[(int)index][13];
         } catch (NullPointerException e) {
             checkMessage(e, "int val = (Math.random() < 0.5 ? a : b)[(int)index][13]", e.getMessage(),
-                         "Cannot load from int array because '<array>[...]' is null.");
+                         "Cannot load from int array because \"<array>[...]\" is null");
         }
 
         try {
@@ -1382,7 +1382,7 @@
             (Math.random() < 0.5 ? c1 : c2).to_d.num = 77;
         } catch (NullPointerException e) {
             checkMessage(e, "(Math.random() < 0.5 ? c1 : c2).to_d.num = 77;", e.getMessage(),
-                         "Cannot assign field 'num' because 'to_d' is null.");
+                         "Cannot assign field \"num\" because \"to_d\" is null");
         }
 
         // Static variable as array index.
@@ -1391,7 +1391,7 @@
         }  catch (NullPointerException e) {
             checkMessage(e, "staticLongArray[index17][0] = 2L;",  e.getMessage(),
                          "Cannot store to long array because " +
-                         "'NullPointerExceptionTest.staticLongArray[NullPointerExceptionTest.index17]' is null.");
+                         "\"NullPointerExceptionTest.staticLongArray[NullPointerExceptionTest.index17]\" is null");
         }
 
         // Method call as array index.
@@ -1400,7 +1400,7 @@
         }  catch (NullPointerException e) {
             checkMessage(e, "staticLongArray[getIndex17()][0] = 2L;",  e.getMessage(),
                          "Cannot store to long array because " +
-                         "'NullPointerExceptionTest.staticLongArray[NullPointerExceptionTest.getIndex17()]' is null.");
+                         "\"NullPointerExceptionTest.staticLongArray[NullPointerExceptionTest.getIndex17()]\" is null");
         }
 
         // Unboxing.
@@ -1409,8 +1409,8 @@
             int b = a;
         }  catch (NullPointerException e) {
             checkMessage(e, "Integer a = null; int b = a;",  e.getMessage(),
-                         "Cannot invoke 'java.lang.Integer.intValue()' because " +
-                         (hasDebugInfo ? "'a'" : "'<local1>'") + " is null.");
+                         "Cannot invoke \"java.lang.Integer.intValue()\" because " +
+                         (hasDebugInfo ? "\"a\"" : "\"<local1>\"") + " is null");
         }
 
         // Unboxing by hand. Has the same message as above.
@@ -1418,8 +1418,8 @@
             int b = a.intValue();
         }  catch (NullPointerException e) {
             checkMessage(e, "Integer a = null; int b = a.intValue();",  e.getMessage(),
-                         "Cannot invoke 'java.lang.Integer.intValue()' because " +
-                         (hasDebugInfo ? "'a'" : "'<local1>'") + " is null.");
+                         "Cannot invoke \"java.lang.Integer.intValue()\" because " +
+                         (hasDebugInfo ? "\"a\"" : "\"<local1>\"") + " is null");
         }
     }
 
@@ -1562,7 +1562,7 @@
         } catch (NullPointerException ex) {
             checkMessage(ex, "return f.i;",
                          ex.getMessage(),
-                         "Cannot read field 'i' because 'f' is null.");
+                         "Cannot read field \"i\" because \"f\" is null");
         }
 
         // Optimized bytecode can reuse local variable slots for several
@@ -1580,7 +1580,7 @@
         } catch (NullPointerException ex) {
             checkMessage(ex, "s1.substring(1)",
                          ex.getMessage(),
-                         "Cannot invoke 'String.substring(int)' because '<parameter1>' is null.");
+                         "Cannot invoke \"String.substring(int)\" because \"<parameter1>\" is null");
         }
         // Expect message saying "local0".
         try {
@@ -1588,7 +1588,7 @@
         } catch (NullPointerException ex) {
             checkMessage(ex, "s1_2.substring(1)",
                          ex.getMessage(),
-                         "Cannot invoke 'String.substring(int)' because '<local1>' is null.");
+                         "Cannot invoke \"String.substring(int)\" because \"<local1>\" is null");
         }
         // Expect message saying "parameter4".
         try {
@@ -1596,7 +1596,7 @@
         } catch (NullPointerException ex) {
             checkMessage(ex, "s4.substring(1)",
                          ex.getMessage(),
-                         "Cannot invoke 'String.substring(int)' because '<parameter4>' is null.");
+                         "Cannot invoke \"String.substring(int)\" because \"<parameter4>\" is null");
         }
         // Expect message saying "local4".
         try {
@@ -1604,7 +1604,7 @@
         } catch (NullPointerException ex) {
             checkMessage(ex, "s4_2.substring(1)",
                          ex.getMessage(),
-                         "Cannot invoke 'String.substring(int)' because '<local4>' is null.");
+                         "Cannot invoke \"String.substring(int)\" because \"<local4>\" is null");
         }
 
         // Unfortunately, with the fix for optimized code as described above
@@ -1618,7 +1618,7 @@
             } catch (NullPointerException ex) {
                 checkMessage(ex, "s1.substring(1)",
                              ex.getMessage(),
-                             "Cannot invoke 'String.substring(int)' because '<parameter1>' is null.");
+                             "Cannot invoke \"String.substring(int)\" because \"<parameter1>\" is null");
             }
             // The message says "local1" although "parameter1" would be correct.
             try {
@@ -1626,7 +1626,7 @@
             } catch (NullPointerException ex) {
                 checkMessage(ex, "s1.substring(2)",
                              ex.getMessage(),
-                             "Cannot invoke 'String.substring(int)' because '<local1>' is null.");
+                             "Cannot invoke \"String.substring(int)\" because \"<local1>\" is null");
             }
         }
     }
diff --git a/test/hotspot/jtreg/runtime/exceptionMsgs/NullPointerException/SuppressMessagesTest.java b/test/hotspot/jtreg/runtime/exceptionMsgs/NullPointerException/SuppressMessagesTest.java
--- a/test/hotspot/jtreg/runtime/exceptionMsgs/NullPointerException/SuppressMessagesTest.java
+++ b/test/hotspot/jtreg/runtime/exceptionMsgs/NullPointerException/SuppressMessagesTest.java
@@ -61,7 +61,7 @@
         A a = null;
 
         if (args.length != 1) {
-            Asserts.fail("You must specify one arg for this test.");
+            Asserts.fail("You must specify one arg for this test");
         }
 
         try {
@@ -75,7 +75,7 @@
             if (args[0].equals("noMessage")) {
                 Asserts.assertNull(e.getMessage());
             } else {
-                Asserts.assertEquals(e.getMessage(), "Cannot read field 'aFld' because 'a' is null.");
+                Asserts.assertEquals(e.getMessage(), "Cannot read field \"aFld\" because \"a\" is null");
             }
         }
     }

Reply via email to