[15] RFR: 8248476: No helpful NullPointerException message after calling fillInStackTrace

Christoph Dreis christoph.dreis at freenet.de
Mon Jun 29 11:28:03 UTC 2020


Hi Goetz,

> If changing the stack trace by calling fillInStackTrace in user code, the 
> NPE algorithm lacks the proper information to compute the message. 
> Thus, we must omit it after that call.

> I implement this by checking for a call to fillInStackTrace at the bci
> recorded in the exception.  
> http://cr.openjdk.java.net/~goetz/wr20/8248476-NPE_fillInStackTrace-jdk15/01/

I tried this when reporting the issue already. The problem with this is, that it suppresses any valid exception.

E.g. the following example would not throw any helpful NPE anymore.

public class Main {
	public static void main(String[] args) {
		NullPointerException ex = null;
		ex.fillInStackTrace();
	}
}

Cheers,
Christoph





More information about the hotspot-runtime-dev mailing list