From c63c11f1f0eddca4107360e8b85d7223497d6297 Mon Sep 17 00:00:00 2001 From: remm Date: Fri, 1 Sep 2006 13:59:55 +0000 Subject: [PATCH] - Port patch so that getParentCL returns something consistent with the privileged flag. 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 | 30 ++++++++++++++-------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index de8e3d5a5..be61c347a 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -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 after 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); } -- 2.11.0