classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SecurityManager troubles


From: Archie Cobbs
Subject: Re: SecurityManager troubles
Date: Mon, 16 Jan 2006 10:36:38 -0600
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Gary Benson wrote:
+   catch (Throwable t)
+     {
+     }

It might be more appropriate to only catch Exception, not Throwable.

So I was halfway through thinking about this when I forgot and
committed it :(

Why Exception as opposed to Throwable?  My reasoning was that the code
was added to possibly make more things work than do already, and that
anything that might make less things work was to be avoided.

The alternative to Throwable is to catch ClassNotFoundException, which
is the only subclass of Exception that Class.forName throws.

It's definitely not a big deal, but e.g. you should at least not
catch ThreadDeath. Moreover, if there is some obscure, unrelated VM
startup issue, you might get an Error thrown at any time.. if you
discard that here, it might make the obscure issue even more obscure.
This comes from someone who's created his fair share of obscure
VM startup issues :-)

You're right that ClassNotFoundException would be more appropriate
still than Exception. Then the code is clearest about what exactly
is intended.

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]