You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/11/05 00:55:08 UTC

svn commit: r1538810 - /tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java

Author: markt
Date: Mon Nov  4 23:55:08 2013
New Revision: 1538810

URL: http://svn.apache.org/r1538810
Log:
Remove the nonFoundResources collection - WebResources will handle this.

Modified:
    tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java

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=1538810&r1=1538809&r2=1538810&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java (original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Mon Nov  4 23:55:08 2013
@@ -47,7 +47,6 @@ import java.util.ConcurrentModificationE
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
@@ -276,20 +275,6 @@ public class WebappClassLoader extends U
 
 
     /**
-     * The list of not found resources.
-     */
-    protected final HashMap<String, String> notFoundResources =
-        new LinkedHashMap<String, String>() {
-        private static final long serialVersionUID = 1L;
-        @Override
-        protected boolean removeEldestEntry(
-                Map.Entry<String, String> eldest) {
-            return size() > 1000;
-        }
-    };
-
-
-    /**
      * Should this class loader delegate to the parent class loader
      * <strong>before</strong> searching its own repositories (i.e. the
      * usual Java2 delegation model)?  If set to <code>false</code>,
@@ -832,7 +817,6 @@ public class WebappClassLoader extends U
         loader.lastModifiedDates = this.lastModifiedDates.clone();
         loader.paths = this.paths.clone();
 
-        loader.notFoundResources.putAll(this.notFoundResources);
         loader.permissionList.addAll(this.permissionList);
         loader.loaderPC.putAll(this.loaderPC);
 
@@ -1699,7 +1683,6 @@ public class WebappClassLoader extends U
             jarFiles[i] = null;
         }
 
-        notFoundResources.clear();
         resourceEntries.clear();
         resources = null;
         repositoryURLs = null;
@@ -2767,53 +2750,44 @@ public class WebappClassLoader extends U
         String fullPath = "/WEB-INF/classes/" + path;
         resource = resources.getClassLoaderResource("/" + path);
 
-        if (resource.exists()) {
+        if (!resource.exists()) {
+            return null;
+        }
 
-            contentLength = (int) resource.getContentLength();
-            entry = new ResourceEntry();
-            entry.source = resource.getURL();
-            entry.codeBase = entry.source;
-            entry.lastModified = resource.getLastModified();
+        contentLength = (int) resource.getContentLength();
+        entry = new ResourceEntry();
+        entry.source = resource.getURL();
+        entry.codeBase = entry.source;
+        entry.lastModified = resource.getLastModified();
 
-            binaryStream = resource.getInputStream();
+        binaryStream = resource.getInputStream();
 
-            if (needConvert) {
-                if (path.endsWith(".properties")) {
-                    fileNeedConvert = true;
-                }
+        if (needConvert) {
+            if (path.endsWith(".properties")) {
+                fileNeedConvert = true;
             }
+        }
 
-            // Register the full path for modification checking
-            // Note: Only syncing on a 'constant' object is needed
-            synchronized (allPermission) {
-
-                int j;
+        // Register the full path for modification checking
+        // Note: Only syncing on a 'constant' object is needed
+        synchronized (allPermission) {
 
-                long[] result2 =
-                    new long[lastModifiedDates.length + 1];
-                for (j = 0; j < lastModifiedDates.length; j++) {
-                    result2[j] = lastModifiedDates[j];
-                }
-                result2[lastModifiedDates.length] = entry.lastModified;
-                lastModifiedDates = result2;
+            int j;
 
-                String[] result = new String[paths.length + 1];
-                for (j = 0; j < paths.length; j++) {
-                    result[j] = paths[j];
-                }
-                result[paths.length] = fullPath;
-                paths = result;
+            long[] result2 =
+                new long[lastModifiedDates.length + 1];
+            for (j = 0; j < lastModifiedDates.length; j++) {
+                result2[j] = lastModifiedDates[j];
             }
-        }
+            result2[lastModifiedDates.length] = entry.lastModified;
+            lastModifiedDates = result2;
 
-        if ((entry == null) && (notFoundResources.containsKey(name)))
-            return null;
-
-        if (entry == null) {
-            synchronized (notFoundResources) {
-                notFoundResources.put(name, name);
+            String[] result = new String[paths.length + 1];
+            for (j = 0; j < paths.length; j++) {
+                result[j] = paths[j];
             }
-            return null;
+            result[paths.length] = fullPath;
+            paths = result;
         }
 
         JarEntry jarEntry = null;



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