tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominik Drzewiecki" <>
Subject Re: JDTCompiler and locked jar files *again*
Date Fri, 17 Dec 2004 13:00:38 GMT
Remy Maucherat <> wrote:
> It's a hack though. JasperLoader shouldn't have the JARs in its 
> repositories, so it is supposed to delegate.

It *does* delegate to its parent classloader (which is WebappClassLoader)
The only difference is that my solution sets useCaches to false on obtained 
URLConnection before opening an InputStream.
There are no repositories related with JasperLoader.

in o.a.j.c.JDTCompiler there is such an invocation in findType(String)

is = classLoader.getResourceAsStream(resourceName);

classLoader is an instance of JasperLoader, which does not override 
Since there is also no getResourceAsStream in its superclass 
j.n.URLClasLoader, ClassLoader's implementation getResourceAsStream(String) 
is used
It (java.lang.ClassLoader) is implemented like this:
public InputStream getResourceAsStream(String name) {
	URL url = getResource(name);
	try {
	    return url != null ? url.openStream() : null;
	} catch (IOException e) {
	    return null;

Notice that openStream() is a short for getConnection().getInputStream().

As you can clearly see after applying my "hack" after an invocation of

is = classLoader.getResourceAsStream(resourceName);

"is" is assigned an InputStream opened on an *uncached* JarURLConnection.

Te question arises - is there any benefit of having cached 
I haven't checked that in the sources of jdk as 
is abstract and implemented in

>> PS. I hope that I don't get cursed again.
> It's easy: don't be annoying, and avoid whining.

I try hard not to be annoying.
And I'am not whining - I try to be helpfull.

> For example, what's up with that bug ?
> Is it relevant or not ?

It is. It is an outcome of my investigation. Fixing it (closing the stream),
 however, does no good.
But I'm pretty sure it is a good habit to cleanup.


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

View raw message