classpath
[Top][All Lists]
Advanced

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

RE: SecurityManager troubles


From: Jeroen Frijters
Subject: RE: SecurityManager troubles
Date: Mon, 16 Jan 2006 17:27:22 +0100

Gary Benson wrote:
> Archie Cobbs wrote:
> > Gary Benson wrote:
> > > +   try
> > > +     {
> > > +       Class.forName("java.security.Security");
> > > +     }
> > > +   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?

If one of our VMs has a bug (it does happen ;-)) swallowing exceptions
makes it much harder to debug (or to even notice it).

> 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.

Simply catching ClassNotFoundException would be best. Sorry for not
noticing that before.

Regards,
Jeroen




reply via email to

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