NullPointerException….

August 24th, 2003 by Hen

Why oh why can’t the NPException message tell me which variable the NPE was called upon?

That one simple change would be worthy of all of JDK1.5 for me.

5 Responses to “NullPointerException….”

  1. Anon Says:

    It may be not a variable. Just an expression. And you can find it out already in 1.4

  2. Bob Lee Says:

    That’s what stack traces are for. ;)

  3. Keith Lea Says:

    Bob: if you have multiple method calls on one line, you often need more than the stack trace:

    x.y(z.a(), b.c(), d.e());

  4. steve Says:

    I’d imagine it’s just hard to do so Sun took the easy route. I generally think NPE is an Error anyway. Further still, all RuntimeExceptions need to become either Errors or checked Exceptions. If it’s an exceptional termination of a method then that’s known and should be checked. Otherwise it’s a full-blown error. Anyway, even tho’ this is not a troll, FLAME-ON!

  5. Anon Ymus Says:

    That’s what debuggers, breakpoints and watches are for…