tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stuart Stephen" <>
Subject RE: Illegal Access Error [ URLConnection ]
Date Fri, 05 Dec 2003 11:39:27 GMT
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 []
Sent: 05 December 2003 11:37
To: 'Tomcat Users List'
Subject: AW: Illegal Access Error [ URLConnection ]


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


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message