billbarker    02/01/15 21:06:01

  Modified:    src/share/org/apache/tomcat/util/depend
                        DependClassLoader12.java
  Log:
  Change to use JarFile rather than JarURLConnection.
  
  Continuing to work around the problems with Java 1.3.x locking up jar files.  Now, 
the jar file is closed after defining the package (and so can be replaced w/o waiting 
for finalize).  Now, it should be possible to have both the good reloading of 3.3 with 
the brain-challenged loading behavior of 3.2.  This is about as non-critical as code 
in 3.3 gets, so the extra open/close shouldn't hurt perfomance at all.
  
  Also some formatting fixes.
  
  Revision  Changes    Path
  1.8       +13 -13    
jakarta-tomcat/src/share/org/apache/tomcat/util/depend/DependClassLoader12.java
  
  Index: DependClassLoader12.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/depend/DependClassLoader12.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DependClassLoader12.java  9 Jan 2002 06:21:14 -0000       1.7
  +++ DependClassLoader12.java  16 Jan 2002 05:06:01 -0000      1.8
  @@ -65,7 +65,6 @@
   import java.security.*;
   
   import org.apache.tomcat.util.compat.*;
  -
   /** 
    * 1.2 support for DependClassLoader
    * 
  @@ -115,19 +114,19 @@
             if ( p == null ) {
               if ( "jar".equals(res.getProtocol()) ) {
                 try {
  -                JarURLConnection juconn = 
  -                          (JarURLConnection)res.openConnection();
  -                Manifest mf = juconn.getManifest();
  -             if(mf == null) // Jar may not be Java2
  -                throw new IOException("No Manifest");
  -                Attributes main = mf.getMainAttributes();
  -                Attributes pkg = mf.getAttributes(
  -                  pkgname.replace('.', '/').concat("/")
  -                );
  -                boolean sealed = Boolean.valueOf(
  -                  getAttribute(Attributes.Name.SEALED, main, pkg)
  +               String JarN = res.getFile();
  +               JarFile JarF = new JarFile(JarN);
  +               Manifest mf = JarF.getManifest();
  +               if(mf == null) // Jar may not be Java2
  +                   throw new IOException("No Manifest");
  +               Attributes main = mf.getMainAttributes();
  +               Attributes pkg = mf.getAttributes(
  +                      pkgname.replace('.', '/').concat("/")
  +               );
  +               boolean sealed = Boolean.valueOf(
  +                         getAttribute(Attributes.Name.SEALED, main, pkg)
                     ).booleanValue();
  -                definePackage(
  +               definePackage(
                     pkgname, 
                     getAttribute(Attributes.Name.SPECIFICATION_TITLE, main, pkg),
                     getAttribute(Attributes.Name.SPECIFICATION_VERSION, main, pkg),
  @@ -137,6 +136,7 @@
                     getAttribute(Attributes.Name.IMPLEMENTATION_VENDOR, main, pkg),
                     sealed ? res : null
                   );
  +               JarF.close();
                 } catch ( IOException e ) {
                   definePackage(pkgname, null, null, null, null, null, null, null);
                 }
  
  
  

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

Reply via email to