This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new 510c71b009 Set context CL before calling XMLInputFactory.newFactory 510c71b009 is described below commit 510c71b009085f94122bc18501d1981322846540 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