tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1492973 - in /tomcat/trunk/java/org/apache: catalina/startup/ContextConfig.java catalina/startup/TldConfig.java jasper/compiler/TldLocationsCache.java tomcat/JarScanner.java tomcat/util/scan/StandardJarScanner.java
Date Fri, 14 Jun 2013 07:38:09 GMT
Author: markt
Date: Fri Jun 14 07:38:09 2013
New Revision: 1492973

URL: http://svn.apache.org/r1492973
Log:
Remove class loader from the scan method as class loader is accessible
from ServletContext.

Modified:
    tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
    tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java
    tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java
    tomcat/trunk/java/org/apache/tomcat/JarScanner.java
    tomcat/trunk/java/org/apache/tomcat/util/scan/StandardJarScanner.java

Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1492973&r1=1492972&r2=1492973&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Fri Jun 14 07:38:09 2013
@@ -2042,8 +2042,7 @@ public class ContextConfig implements Li
         JarScanner jarScanner = context.getJarScanner();
         FragmentJarScannerCallback callback = new FragmentJarScannerCallback();
 
-        jarScanner.scan(context.getServletContext(),
-                context.getLoader().getClassLoader(), callback,
+        jarScanner.scan(context.getServletContext(), callback,
                 pluggabilityJarsToSkip);
 
         return callback.getFragments();

Modified: tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java?rev=1492973&r1=1492972&r2=1492973&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/TldConfig.java Fri Jun 14 07:38:09 2013
@@ -263,7 +263,6 @@ public final class TldConfig  implements
         // Stages 3b & 4
         JarScanner jarScanner = context.getJarScanner();
         jarScanner.scan(context.getServletContext(),
-                context.getLoader().getClassLoader(),
                 new TldJarScannerCallback(), noTldJars);
 
         // Now add all the listeners we found to the listeners for this context

Modified: tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java?rev=1492973&r1=1492972&r2=1492973&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/TldLocationsCache.java Fri Jun 14 07:38:09
2013
@@ -242,9 +242,7 @@ public class TldLocationsCache {
 
             JarScanner jarScanner = JarScannerFactory.getJarScanner(ctxt);
             if (jarScanner != null) {
-                jarScanner.scan(ctxt,
-                        Thread.currentThread().getContextClassLoader(),
-                        new TldJarScannerCallback(), noTldJars);
+                jarScanner.scan(ctxt, new TldJarScannerCallback(), noTldJars);
             }
 
             initialized = true;

Modified: tomcat/trunk/java/org/apache/tomcat/JarScanner.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/JarScanner.java?rev=1492973&r1=1492972&r2=1492973&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/JarScanner.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/JarScanner.java Fri Jun 14 07:38:09 2013
@@ -33,12 +33,10 @@ public interface JarScanner {
      *
      * @param context       The ServletContext - used to locate and access
      *                      WEB-INF/lib
-     * @param classloader   The classloader - used to access JARs not in
-     *                      WEB-INF/lib
      * @param callback      The handler to process any JARs found
      * @param jarsToSkip    List of JARs to ignore
      */
-    public void scan(ServletContext context, ClassLoader classloader,
-            JarScannerCallback callback, Set<String> jarsToSkip);
+    public void scan(ServletContext context, JarScannerCallback callback,
+            Set<String> jarsToSkip);
 
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/scan/StandardJarScanner.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/scan/StandardJarScanner.java?rev=1492973&r1=1492972&r2=1492973&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/scan/StandardJarScanner.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/scan/StandardJarScanner.java Fri Jun 14 07:38:09
2013
@@ -127,16 +127,14 @@ public class StandardJarScanner implemen
      *
      * @param context       The ServletContext - used to locate and access
      *                      WEB-INF/lib
-     * @param classloader   The classloader - used to access JARs not in
-     *                      WEB-INF/lib
      * @param callback      The handler to process any JARs found
      * @param jarsToSkip    List of JARs to ignore. If this list is null, a
      *                      default list will be read from the system property
      *                      defined by {@link Constants#SKIP_JARS_PROPERTY}
      */
     @Override
-    public void scan(ServletContext context, ClassLoader classloader,
-            JarScannerCallback callback, Set<String> jarsToSkip) {
+    public void scan(ServletContext context, JarScannerCallback callback,
+            Set<String> jarsToSkip) {
 
         if (log.isTraceEnabled()) {
             log.trace(sm.getString("jarScan.webinflibStart"));
@@ -205,7 +203,7 @@ public class StandardJarScanner implemen
         }
 
         // Scan the classpath
-        if (scanClassPath && classloader != null) {
+        if (scanClassPath) {
             if (log.isTraceEnabled()) {
                 log.trace(sm.getString("jarScan.classloaderStart"));
             }
@@ -216,13 +214,15 @@ public class StandardJarScanner implemen
                 stopLoader = ClassLoader.getSystemClassLoader().getParent();
             }
 
+
+            ClassLoader classLoader = context.getClassLoader();
             // No need to scan the web application class loader - we have
             // already scanned WEB-INF/lib and WEB-INF/classes
-            ClassLoader loader = classloader.getParent();
+            classLoader = classLoader.getParent();
 
-            while (loader != null && loader != stopLoader) {
-                if (loader instanceof URLClassLoader) {
-                    URL[] urls = ((URLClassLoader) loader).getURLs();
+            while (classLoader != null && classLoader != stopLoader) {
+                if (classLoader instanceof URLClassLoader) {
+                    URL[] urls = ((URLClassLoader) classLoader).getURLs();
                     for (int i=0; i<urls.length; i++) {
                         // Extract the jarName if there is one to be found
                         String jarName = getJarName(urls[i]);
@@ -249,7 +249,7 @@ public class StandardJarScanner implemen
                         }
                     }
                 }
-                loader = loader.getParent();
+                classLoader = classLoader.getParent();
             }
         }
     }



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


Mime
View raw message