< prev index next >

src/hotspot/share/interpreter/bytecodeUtils.cpp

Print this page
rev 59841 : 8248476: No helpful NullPointerException message after calling fillInStackTrace
Summary: reported by christoph.dreis@freenet.de
Reviewed-by:

@@ -1150,11 +1150,15 @@
         Symbol* name = cp->symbol_at(name_index);
 
         // Assume the the call of a constructor can never cause a NullPointerException
         // (which is true in Java). This is mainly used to avoid generating wrong
         // messages for NullPointerExceptions created explicitly by new in Java code.
-        if (name != vmSymbols::object_initializer_name()) {
+        //
+        // Also, if the stack trace was filled by a user call, we don't print
+        // the message as it will print the code details where the stack trace
+        // was filled in, not the ones where the NPE was thrown.
+        if (name != vmSymbols::object_initializer_name() && name != vmSymbols::fillInStackTrace_name()) {
           int     type_index = cp->signature_ref_index_at(name_and_type_index);
           Symbol* signature  = cp->symbol_at(type_index);
           // The 'this' parameter was null. Return the slot of it.
           return ArgumentSizeComputer(signature).size();
         } else {
< prev index next >