"Nicholas R. Rinard" <email@hidden> wrote:
if( model == null ) {
and, shockingly, this line of code is throwing a null pointer
exception. this line of code is called from within my app startup
routine but is called after model is initialized.
A NullPointerException in that expression should be impossible. The
bytecodes that should be compiled for that statement are specifically
designed to work with null and not throw NPE.
Please provide an example that consistently throws the exception.
Also,
which Java version and OS version is this happening on?
One possible explanation is that the line-number stated in the
exception is
only approximate, and the real culprit is on a nearby line, either
before
or after the line-number in the exception.
Another possibility is that the source wasn't recompiled, so the
line-number in the class-file is exact but you're looking at source
that
doesn't match the executed bytecodes.
Those are just guesses, though.
If you're absolutely certain it's not a mistake like the above, you
can use
the 'javap -c' command to disassemble the class's bytecodes (read 'man
javap' for info). You should see an 'ifnonnull' bytecode where your
source
has 'if (model==null)'. An ifnonnull branches when its operand is
non-null, therefore it would execute the following code, the body of
your
'if', when its operand (model) is null.
-- GG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden
This email sent to email@hidden