Dominik Drzewiecki wrote:
Remy Maucherat <[EMAIL PROTECTED]> wrote:

So do I as that is exacly what my proposed "hack" does.

The WCL doesn't do the same thing when you call getResource or getResourceAsStream. Using getResource is less efficient. That's the idea.


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 ;)

What I plan to commit is add:

    public InputStream getResourceAsStream(String name) {
        return parent.getResourceAsStream(name);
    }

and possibly, since we never need to search the internal repositories:

    public URL getResource(String name) {
        return parent.getResource(name);
    }

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

It might make getResourceAsStream more expensive, that's the problem.

(and stop posting your messages multiple times)

Rémy

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



Reply via email to