Hi,

since Java 5, our internal VM reports verbose null pointer exception
messages. I would like to contribute this feature to OpenJDK.

With this change, messages as
   "java.lang.NullPointerException: while trying to load from a null int array 
loaded from local variable 'ia1'"
are printed.  For more examples see the JBS bug or the test included.
https://bugs.openjdk.java.net/browse/JDK-8218628

The messages are generated by parsing the bytecodes. For not to have any 
overhead when the
NPE is allocated, the message is only generated when it is accessed by 
getMessage() or
serialization. For this I added a field to NPE to indicate that the message 
still needs to be
computed lazily.

Please review:
http://cr.openjdk.java.net/~goetz/wr19/8218628-exMsg-NPE/01/
I'm happy to incorporate your comments.

Best regards,
  Goetz


Reply via email to