tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bojan Smojver <bo...@binarix.com>
Subject Bug in TC 3.3 DependClassLoader
Date Wed, 12 Sep 2001 12:09:36 GMT
Since I was playing with distributing all my apps in jars...

In method dependency() of that class, there is a section for jars. It
goes something like this:

----------------------------
        if( "jar".equals( res.getProtocol() )) {
            String fileN=res.getFile();
            int idx=fileN.indexOf( "!" );
            if( idx>=0 )
                fileN=fileN.substring( 0, idx) ;
            f=new File( fileN );
            if( debug > 0 ) log( "Jar dep "  +f );
            if( ! f.exists()) f=null;
        }

        if( f==null ) return;
        Dependency dep=new Dependency();
        dep.setLastModified( f.lastModified() );
        dep.setTarget( c );
        dep.setOrigin( f );

        dependM.addDependency( dep );
----------------------------

So if the res is:

----------------------------
jar:file:/home/httpd/html/binarix.dev/WEB-INF/lib/app.jar!/com/binarix/wpm/ParseXML.class
----------------------------

then fileN after res.getFile() is:

----------------------------
file:/home/httpd/html/binarix.dev/WEB-INF/lib/app.jar!/com/binarix/wpm/ParseXML.class
----------------------------

and after tossing everything after the bang, it becomes:

----------------------------
file:/home/httpd/html/binarix.dev/WEB-INF/lib/app.jar
----------------------------

which is NOT a file (a URL maybe?), so f.exists() returns false and f
becomes null. The method dependency() returns without adding the jar in
question to the list of dependencies. Aieeeee!

Maybe there should be another 'file' section inside the 'jar' section to
resolve that URL?

If you guys think that'd work OK, I can write a little patch...

Bojan

Mime
View raw message