This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new c408737 BZ 64153. Ensure Context.getParentClassLoader() is consistent c408737 is described below commit c4087371103c164dbf67fee79607f3a758a55604 Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Feb 26 17:43:41 2020 +0000 BZ 64153. Ensure Context.getParentClassLoader() is consistent Deprecate the setting of the parent class loader via the Loader and if it is set via the loader, keep it in sync with the Context. Fixes https://bz.apache.org/bugzilla/show_bug.cgi?id=64153 --- java/org/apache/catalina/core/StandardContext.java | 2 +- java/org/apache/catalina/loader/WebappLoader.java | 11 +++++++++-- webapps/docs/changelog.xml | 4 ++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java index 24a5296..704cadc 100644 --- a/java/org/apache/catalina/core/StandardContext.java +++ b/java/org/apache/catalina/core/StandardContext.java @@ -4947,7 +4947,7 @@ public class StandardContext extends ContainerBase } if (getLoader() == null) { - WebappLoader webappLoader = new WebappLoader(getParentClassLoader()); + WebappLoader webappLoader = new WebappLoader(); webappLoader.setDelegate(getDelegate()); setLoader(webappLoader); } diff --git a/java/org/apache/catalina/loader/WebappLoader.java b/java/org/apache/catalina/loader/WebappLoader.java index d7e3b98..8ddf716 100644 --- a/java/org/apache/catalina/loader/WebappLoader.java +++ b/java/org/apache/catalina/loader/WebappLoader.java @@ -66,8 +66,8 @@ public class WebappLoader extends LifecycleMBeanBase // ----------------------------------------------------------- Constructors /** - * Construct a new WebappLoader with no defined parent class loader - * (so that the actual parent will be the system class loader). + * Construct a new WebappLoader. The parent class loader will be defined by + * {@link Context#getParentClassLoader()}. */ public WebappLoader() { this(null); @@ -79,7 +79,12 @@ public class WebappLoader extends LifecycleMBeanBase * to be defined as the parent of the ClassLoader we ultimately create. * * @param parent The parent class loader + * + * @deprecated Use {@link Context#setParentClassLoader(ClassLoader)} to + * specify the required class loader. This method will be + * removed in Tomcat 10 onwards. */ + @Deprecated public WebappLoader(ClassLoader parent) { super(); this.parentClassLoader = parent; @@ -509,6 +514,8 @@ public class WebappLoader extends LifecycleMBeanBase if (parentClassLoader == null) { parentClassLoader = context.getParentClassLoader(); + } else { + context.setParentClassLoader(parentClassLoader); } Class<?>[] argTypes = { ClassLoader.class }; Object[] args = { parentClassLoader }; diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 54dd17d..31cc098 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -71,6 +71,10 @@ Missing store config attributes for Resources elements. (remm) </fix> <fix> + <bug>64153</bug>: Ensure that the parent for the web application class + loader is set consistently. + </fix> + <fix> <bug>64166</bug>: Ensure that the names returned by <code>HttpServletResponse.getHeaderNames()</code> are unique. (markt) </fix> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org