- Port patch so that getParentCL returns something consistent with the privileged...
authorremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 1 Sep 2006 13:59:55 +0000 (13:59 +0000)
committerremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 1 Sep 2006 13:59:55 +0000 (13:59 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@439324 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/core/StandardContext.java

index de8e3d5..be61c34 100644 (file)
@@ -1538,6 +1538,24 @@ public class StandardContext
         this.originalDocBase = docBase;
     }
     
+
+    /**
+     * Return the parent class loader (if any) for this web application.
+     * This call is meaningful only <strong>after</strong> a Loader has
+     * been configured.
+     */
+    public ClassLoader getParentClassLoader() {
+        if (parentClassLoader != null)
+            return (parentClassLoader);
+        if (getPrivileged()) {
+            return this.getClass().getClassLoader();
+        } else if (parent != null) {
+            return (parent.getParentClassLoader());
+        }
+        return (ClassLoader.getSystemClassLoader());
+    }
+
+    
     /**
      * Return the privileged flag for this web application.
      */
@@ -4117,17 +4135,7 @@ public class StandardContext
         }
         
         if (getLoader() == null) {
-            ClassLoader parent = null;
-            if (getPrivileged()) {
-                if (log.isDebugEnabled())
-                    log.debug("Configuring privileged default Loader");
-                parent = this.getClass().getClassLoader();
-            } else {
-                if (log.isDebugEnabled())
-                    log.debug("Configuring non-privileged default Loader");
-                parent = getParentClassLoader();
-            }
-            WebappLoader webappLoader = new WebappLoader(parent);
+            WebappLoader webappLoader = new WebappLoader(getParentClassLoader());
             webappLoader.setDelegate(getDelegate());
             setLoader(webappLoader);
         }