tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Isaacs <Larry.Isa...@sas.com>
Subject RE: Bug in TC 3.3 DependClassLoader
Date Wed, 12 Sep 2001 19:07:43 GMT
Hi Bojan,

Costin is the expert on this section of code.  I need to become
more familiar with it, so I'm willing to take a look.  If you can
submit a patch, that would be helpful.  If you need to wait for
Costin's advice, I understand.  On occasion, I have had to do
the same.

Cheers,
Larry

> -----Original Message-----
> From: Bojan Smojver [mailto:bojan@binarix.com]
> Sent: Wednesday, September 12, 2001 8:10 AM
> To: Tomcat Dev List
> Subject: Bug in TC 3.3 DependClassLoader
> 
> 
> 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/bin
arix/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