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 14:13:17 GMT
Remy Maucherat <> wrote:
> There are other solutions:
> - modify findType to use getResource instead of getResourceAsStream
> - have JasperLoader.getResourceAsSteam (and possibly getResource as 
> well) do nothing and delegate to parent.getResourceAsStream (and 
> getResource)
> I think I like the second one.

So do I as that is exacly what my proposed "hack" does.
There is no need to provide JasperLoader.getResource(String) as the 
inherited from java.lang.ClassLoader getResource(String) is cool, it 
already delegates to parent first if there is one. Here it is, as 
implemented in java.lang.ClassLoader:

    public URL getResource(String name) {
	URL url;
	if (parent != null) {
	    url = parent.getResource(name);
	} else {
	    url = getBootstrapResource(name);
	if (url == null) {
	    url = findResource(name);
	return url;

So it is enough to provide only JasperLoader.getResourceAsStream(String) 
which in turn invokes getResource(String) to obtain URL to requested 
resource. As there is no implementation of such method provided in 
JasperLoader, the implementation of ClassLoader is used (which delegates to 
parent). I hope I made myself clear (I realize that a patch is worth 
thousand words ;)

It's not that hacky after all, is it?


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

View raw message