This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push: new 9f4a88697b Set context CL before calling XMLInputFactory.newFactory 9f4a88697b is described below commit 9f4a88697b717fcf783596938da005df0899e2fe Author: remm <r...@apache.org> AuthorDate: Mon Mar 25 10:45:28 2024 +0100 Set context CL before calling XMLInputFactory.newFactory Passing the CL to XMLInputFactory.newFactory does not work because it needs an id (basically the concrete class to load). Try the context CL instead. The class is preloaded for previous Tomcat versions so it shouldn't be a security manager issue. --- java/org/apache/jasper/compiler/EncodingDetector.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/java/org/apache/jasper/compiler/EncodingDetector.java b/java/org/apache/jasper/compiler/EncodingDetector.java index cf3b623104..fb7795ca16 100644 --- a/java/org/apache/jasper/compiler/EncodingDetector.java +++ b/java/org/apache/jasper/compiler/EncodingDetector.java @@ -35,8 +35,15 @@ class EncodingDetector { private static final XMLInputFactory XML_INPUT_FACTORY; static { - XML_INPUT_FACTORY = XMLInputFactory.newFactory(XMLInputFactory.class.getName(), - EncodingDetector.class.getClassLoader()); + ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); + try { + Thread.currentThread().setContextClassLoader(EncodingDetector.class.getClassLoader()); + XML_INPUT_FACTORY = XMLInputFactory.newFactory(); + } finally { + if (oldCl != null) { + Thread.currentThread().setContextClassLoader(oldCl); + } + } } private final String encoding; --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org