tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1593072 - in /tomcat/trunk: java/org/apache/catalina/loader/WebappClassLoader.java webapps/docs/changelog.xml
Date Wed, 07 May 2014 17:25:36 GMT
Author: markt
Date: Wed May  7 17:25:36 2014
New Revision: 1593072

URL: http://svn.apache.org/r1593072
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56481
Work around case insensitivity issue in URLClassLoader

Modified:
    tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=1593072&r1=1593071&r2=1593072&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java (original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Wed May  7 17:25:36
2014
@@ -42,12 +42,14 @@ import java.security.Policy;
 import java.security.PrivilegedAction;
 import java.security.ProtectionDomain;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.ConcurrentModificationException;
 import java.util.Date;
 import java.util.Enumeration;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
@@ -420,6 +422,13 @@ public class WebappClassLoader extends U
      */
     private boolean hasExternalRepositories = false;
 
+
+    /**
+     * Repositories managed by this class rather than the super class.
+     */
+    private Set<URL> localRepositories = new HashSet<>();
+
+
     private volatile LifecycleState state = LifecycleState.NEW;
 
 
@@ -1370,7 +1379,10 @@ public class WebappClassLoader extends U
      */
     @Override
     public URL[] getURLs() {
-        return super.getURLs();
+        ArrayList<URL> result = new ArrayList<>();
+        result.addAll(localRepositories);
+        result.addAll(Arrays.asList(super.getURLs()));
+        return result.toArray(new URL[result.size()]);
     }
 
 
@@ -1447,12 +1459,12 @@ public class WebappClassLoader extends U
 
         WebResource classes = resources.getResource("/WEB-INF/classes");
         if (classes.isDirectory() && classes.canRead()) {
-            addURL(classes.getURL());
+            localRepositories.add(classes.getURL());
         }
         WebResource[] jars = resources.listResources("/WEB-INF/lib");
         for (WebResource jar : jars) {
             if (jar.getName().endsWith(".jar") && jar.isFile() && jar.canRead())
{
-                addURL(jar.getURL());
+                localRepositories.add(jar.getURL());
                 jarModificationTimes.put(
                         jar.getName(), Long.valueOf(jar.getLastModified()));
             }

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1593072&r1=1593071&r2=1593072&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Wed May  7 17:25:36 2014
@@ -146,6 +146,10 @@
         problem is encountered calling a getter or setter on a component
         attribute. The logging level is raised from debug to warning. (markt)
       </fix>
+      <fix>
+        <bug>56481</bug>: Work around case insensitivity issue in
+        <code>URLClassLoader</code> exposed by some recent refactoring. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



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


Mime
View raw message