From: Peter Duniho on
Lew wrote:
> Jack wrote, quoted or indirectly quoted someone who said :
>>>> Does java [sic] NullPointerException always cause crash?
>
> According to Roedy Green :
>>> it never causes a crash.
>
> Thomas Pornin wrote:
>> Theoretically you are right. However I did encounter JVM implementations
>> which occasionally had trouble with NullPointerException (including a
>> port of Sun's JVM for FreeBSD).
>
> Come on, guys, Jcheeze! The OP clearly meant crash of his program, not
> the JVM.

Uh. You, of all people, complaining about pedantry, however irrelevant
to the question at hand?

How droll.

> The answer is that uncaught exceptions will cause termination of a
> program. Ones you catch and deal with properly will not.

That depends on the context. The EDT eats exceptions for lunch.
Probably thread-pool implementations too.

Pete
From: Lew on
Lew wrote:
>> Come on, guys, Jcheeze! The OP clearly meant crash of his program,
>> not the JVM.

Peter Duniho wrote:
> Uh. You, of all people, complaining about pedantry, however irrelevant
> to the question at hand?
>
> How droll.

I just can't make anyone happy, can I? I put forth the helpful attitude
people have always told me here they want from me and you dump a load of
manure on me.

How droll.

And I certainly didn't complain about pedantry. I complained pedantically
that people were misinterpreting the OP's obvious intent.

If helping the querent was wrong, I don't want to be right.

--
Lew
From: Peter Duniho on
Lew wrote:
> I just can't make anyone happy, can I? I put forth the helpful attitude
> people have always told me here they want from me and you dump a load of
> manure on me.

Sorry. Frankly, your comment was helpful, and I should not have been so
cursory in my reply.

My amusement came from the fact that, rather than replying directly to
the original poster, with your own observations based on your own likely
correct inference of his intent, you instead chose to criticize (however
correctly :) ) in the way you did.

> [...] And I certainly didn't complain about pedantry. I complained
> pedantically that people were misinterpreting the OP's obvious intent.

Well, you did reply to Thomas's post, which could itself be described as
pedantry relative to Roedy's post. Roedy took a specific definition of
crash (see Eric's reply for why Roedy was neither right nor wrong in his
choice) and provided a reasonably factual answer, notwithstanding the
exception to his reply that Thomas pedantically describes.

It looked to me like you were complaining about pedantry (Thomas's in
particular), but perhaps I misconstrued.

> If helping the querent was wrong, I don't want to be right.

Have you in fact helped the querent? After all, you stated that a
NullPointerException always terminates the program. Even ignoring that
you've arbitrarily chosen a different definition of "crash" than Roedy
chose, however more likely that definition might be to be correct it
still remains that your conclusion wasn't precisely correct.

That is, I will (pedantically) point out that you claimed that
"[exceptions] that YOU catch and deal with properly will not [cause
termination of a program]". Clearly implying that exceptions YOU do NOT
catch and deal with property WILL cause termination of the program.

Except that there are examples of areas of the Java API where exceptions
are caught on your behalf, not by YOU.

(Emphasis added above for clarity)

Okay, you may now feel free to complain about my pedantry. :)

Pete
From: Mike Schilling on
Lew wrote:
> Runtime exceptions are designed not to be caught, but to cause a
> program to abort. It is not usual (nor, in my opinion, usually
> correct) to handle runtime exceptions routinely.

The obvious exception here arises when calling less trusted code. If a web
application throws a runtime exception while processing a request, the
container should catch it and handle it by returning an error reponse to the
caller, not abort. Likewise, when a test harness calls code it's testing,
runtime exceptions should be caught and reported and the next independent
test case run.


From: Roedy Green on
On 25 Feb 2010 13:26:18 GMT, Thomas Pornin <pornin(a)bolet.org> wrote,
quoted or indirectly quoted someone who said :

>To be precise, in many JVM, null references are not checked before
>access; instead, the access is trapped by the OS, which generates a
>system-level exception (on Unix-like systems, a SIGSEGV or SIGBUS
>signal). The JVM intercepts that signal, obtains the faulty code
>address, and converts the signal into a NullPointerException which is
>then thrown in the offending thread.

How did you discover this?
--
Roedy Green Canadian Mind Products
http://mindprod.com

The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair.
~ Douglas Adams (born: 1952-03-11 died: 2001-05-11 at age: 49)