Yet Throwable is more generic as Exception. Try it. 

-- 
SH Solutions, Steffen Heil
Web: http://www.sh-solutions.de
eMail: [EMAIL PROTECTED]
MSNMS: [EMAIL PROTECTED]
-----Ursprüngliche Nachricht-----
Von: Stuart Stephen [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 5. Dezember 2003 12:39
An: Tomcat Users List
Betreff: RE: Illegal Access Error [ URLConnection ] 

I tried putting a try and catch block around it to catch a the generic
Exception. Yet that didn't work.

Something is still a-miss?

-----Original Message-----
From: SH Solutions [mailto:[EMAIL PROTECTED]
Sent: 05 December 2003 11:37
To: 'Tomcat Users List'
Subject: AW: Illegal Access Error [ URLConnection ]


Hi

> When I do URLConnection.guessContentTypeFromName(filename) I get an
IllegalAccessError thrown. Yet, I cannot catch this as the method only
throws an IOException.

I dont know where this comes from since I dont have any idea what this
method is all about.
But I can tell you how to catch the Exception.

try {
  ..
} catch ( IllegalAccessError iae ) {
}

As of you post I guess you thought that you couldn't catch a Exception that
is not declared to be thrown by the method in question. But this is only
half the truth. You can throw everything that inherits from Throwable.
Descendents of Exception are such classes, but there are more.

You can catch about everything if you use this;

} catch ( Throwable t ) {
  t.printStackTrace(); // not required but a good start.
...

Cu
  Steffen


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to