tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java
Date Mon, 29 Apr 2002 12:46:54 GMT
remm        02/04/29 05:46:54

  Modified:    catalina/src/share/org/apache/catalina/loader
                        WebappClassLoader.java
  Log:
  - Use the JAR URL for the codeBase (the exact source is kept separate).
  - This should fix bug 8611.
  - AFAIK, this is closer to what the URL CL is doing.
  - This will also force a modification of the policy files (the codeBase must
    be the JAR). Glenn, I think you mentioned a while ago you were ok with
    that change.
  - This change will not be ported to 4.0.x (at least not without some convincing,
    as it breaks the existing policy files). The change will be included in 4.1.1.
  
  Revision  Changes    Path
  1.37      +23 -16    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- WebappClassLoader.java	17 Feb 2002 08:41:25 -0000	1.36
  +++ WebappClassLoader.java	29 Apr 2002 12:46:54 -0000	1.37
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
1.36 2002/02/17 08:41:25 remm Exp $
  - * $Revision: 1.36 $
  - * $Date: 2002/02/17 08:41:25 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
1.37 2002/04/29 12:46:54 remm Exp $
  + * $Revision: 1.37 $
  + * $Date: 2002/04/29 12:46:54 $
    *
    * ====================================================================
    *
  @@ -145,7 +145,7 @@
    *
    * @author Remy Maucherat
    * @author Craig R. McClanahan
  - * @version $Revision: 1.36 $ $Date: 2002/02/17 08:41:25 $
  + * @version $Revision: 1.37 $ $Date: 2002/04/29 12:46:54 $
    */
   public class WebappClassLoader
       extends URLClassLoader
  @@ -1607,7 +1607,7 @@
                       definePackage(packageName, null, null, null, null, null,
                                     null, null);
                   } else {
  -                    definePackage(packageName, entry.manifest, entry.source);
  +                    definePackage(packageName, entry.manifest, entry.codeBase);
                   }
               }
   
  @@ -1615,7 +1615,7 @@
   
           // Create the code source object
           CodeSource codeSource =
  -            new CodeSource(entry.source, entry.certificates);
  +            new CodeSource(entry.codeBase, entry.certificates);
   
           if (securityManager != null) {
   
  @@ -1623,7 +1623,7 @@
               if (pkg != null) {
                   boolean sealCheck = true;
                   if (pkg.isSealed()) {
  -                    sealCheck = pkg.isSealed(entry.source);
  +                    sealCheck = pkg.isSealed(entry.codeBase);
                   } else {
                       sealCheck = (entry.manifest == null)
                           || !isPackageSealed(packageName, entry.manifest);
  @@ -1636,7 +1636,7 @@
   
           }
   
  -        synchronized(entry) {
  +        synchronized (entry) {
               // Since all threads use the same ResourceEntry instance, it is
               // the one which will contain the class
               if (entry.loadedClass == null) {
  @@ -1699,6 +1699,7 @@
                   entry = new ResourceEntry();
                   try {
                       entry.source = getURL(new File(files[i], path));
  +                    entry.codeBase = entry.source;
                   } catch (MalformedURLException e) {
                       return null;
                   }
  @@ -1756,11 +1757,11 @@
   
                   entry = new ResourceEntry();
                   try {
  -                    String jarFakeUrl = getURL(jarRealFiles[i]).toString();
  +                    entry.codeBase = getURL(jarRealFiles[i]);
  +                    String jarFakeUrl = entry.codeBase.toString();
                       jarFakeUrl = "jar:" + jarFakeUrl + "!/" + path;
                       entry.source = new URL(jarFakeUrl);
                   } catch (MalformedURLException e) {
  -                    e.printStackTrace();
                       return null;
                   }
                   entry.certificates = jarEntry.getCertificates();
  @@ -2038,37 +2039,43 @@
            * The "last modified" time of the origin file at the time this class
            * was loaded, in milliseconds since the epoch.
            */
  -        long lastModified;
  +        protected long lastModified = -1;
   
   
           /**
            * Binary content of the resource.
            */
  -        byte[] binaryContent;
  +        protected byte[] binaryContent = null;
   
   
           /**
            * Loaded class.
            */
  -        Class loadedClass;
  +        protected Class loadedClass = null;
   
   
           /**
            * URL source from where the object was loaded.
            */
  -        URL source;
  +        protected URL source = null;
  +
  +
  +        /**
  +         * URL of the codebase from where the object was loaded.
  +         */
  +        protected URL codeBase = null;
   
   
           /**
            * Manifest (if the resource was loaded from a JAR).
            */
  -        Manifest manifest = null;
  +        protected Manifest manifest = null;
   
   
           /**
            * Certificates (if the resource was loaded from a JAR).
            */
  -        Certificate[] certificates = null;
  +        protected Certificate[] certificates = null;
   
   
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message