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/01 13:56:13 UTC

svn commit: r1537923 - in /tomcat/trunk/java/org/apache/catalina/loader: WebappClassLoader.java WebappLoader.java

Author: markt
Date: Fri Nov  1 12:56:13 2013
New Revision: 1537923

URL: http://svn.apache.org/r1537923
Log:
Remove the repository

Modified:
    tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
    tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.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=1537923&r1=1537922&r2=1537923&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java (original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Fri Nov  1 12:56:13 2013
@@ -315,13 +315,6 @@ public class WebappClassLoader extends U
 
 
     /**
-     * The {@link WebResource} for the repository for locally loaded classes or
-     * resources. This would normally point to /WEB-INF/classes/.
-     */
-    protected WebResource repository = null;
-
-
-    /**
      * The list of JARs, in the order they should be searched
      * for locally loaded classes or resources.
      */
@@ -822,7 +815,6 @@ public class WebappClassLoader extends U
         loader.resources = this.resources;
         loader.delegate = this.delegate;
         loader.lastJarAccessed = this.lastJarAccessed;
-        loader.repository = this.repository;
         loader.jarPath = this.jarPath;
         loader.loaderDir = this.loaderDir;
         loader.canonicalLoaderDir = this.canonicalLoaderDir;
@@ -849,27 +841,6 @@ public class WebappClassLoader extends U
 
     }
 
-    /**
-     * Set the place this ClassLoader can look for classes to be loaded.
-     *
-     * @param path  Path of a source of classes to be loaded, such as a
-     *  directory pathname, a JAR file pathname, or a ZIP file pathname
-     *
-     * @exception IllegalArgumentException if the specified repository is
-     *  invalid or does not exist
-     */
-    synchronized void setRepository(String path, WebResource repository) {
-
-        if (path == null)
-            return;
-
-        if (log.isDebugEnabled())
-            log.debug("addRepository(" + path + ")");
-
-        this.repository = repository;
-    }
-
-
     synchronized void addJar(String jar, JarFile jarFile, File file)
         throws IOException {
 
@@ -1609,19 +1580,20 @@ public class WebappClassLoader extends U
             return repositoryURLs.clone();
         }
 
+        WebResource webInfClasses = resources.getResource("/WEB-INF/classes");
         int resultLength;
-        if (repository == null) {
-            resultLength = jarRealFiles.length;
-        } else {
+        if (webInfClasses.exists()) {
             resultLength = jarRealFiles.length + 1;
+        } else {
+            resultLength = jarRealFiles.length;
         }
 
         int off = 0;
 
         try {
             URL[] urls = new URL[resultLength];
-            if (repository != null) {
-                urls[off ++] = repository.getURL();
+            if (webInfClasses.exists()) {
+                urls[off ++] = webInfClasses.getURL();
             }
             for (File jarRealFile : jarRealFiles) {
                 urls[off++] = getURI(jarRealFile);
@@ -1755,7 +1727,6 @@ public class WebappClassLoader extends U
         resourceEntries.clear();
         resources = null;
         repositoryURLs = null;
-        repository = null;
         jarFiles = null;
         jarRealFiles = null;
         jarPath = null;

Modified: tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java?rev=1537923&r1=1537922&r2=1537923&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java (original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java Fri Nov  1 12:56:13 2013
@@ -669,7 +669,7 @@ public class WebappLoader extends Lifecy
         if (servletContext == null)
             return;
 
-        loaderRepositories=new ArrayList<>();
+        loaderRepositories = new ArrayList<>();
         // Loading the work directory
         File workDir =
             (File) servletContext.getAttribute(ServletContext.TEMPDIR);
@@ -695,8 +695,6 @@ public class WebappLoader extends Lifecy
                 log.debug(sm.getString("webappLoader.classDeploy", classesPath,
                         classes.getURL().toExternalForm()));
 
-            // Adding the repository to the class loader
-            classLoader.setRepository(classesPath + "/", classes);
             loaderRepositories.add(classesPath + "/" );
         }
 



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