Skip to content

Commit

Permalink
LDEV-5157 - change rules for TransformerFactory loading
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Dec 6, 2024
1 parent ca9cb89 commit 7b89cdc
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
45 changes: 27 additions & 18 deletions core/src/main/java/lucee/runtime/text/xml/XMLUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,29 +251,38 @@ public static URL getTransformerFactoryResource() throws IOException {
private static TransformerFactory _newTransformerFactory() {

Thread.currentThread().setContextClassLoader(EnvClassLoader.getInstance((ConfigPro) ThreadLocalPageContext.getConfig()));
TransformerFactory factory = null;
Class clazz = null;
try {
clazz = ClassUtil.loadClass("com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
return TransformerFactory.newInstance();
}
catch (Exception e) {
try {
clazz = ClassUtil.loadClass("org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
}
catch (Exception ee) {
}
catch (Throwable t) {
LogUtil.log("xml", t);
ExceptionUtil.rethrowIfNecessary(t);
}
if (clazz != null) {
try {
factory = (TransformerFactory) ClassUtil.loadInstance(clazz);
}
catch (Exception e) {
}

try {
return (TransformerFactory) ClassUtil.loadInstance(ClassUtil.loadClass("com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"));
}
catch (Throwable t) {
LogUtil.log("xml", t);
ExceptionUtil.rethrowIfNecessary(t);
}
if (factory == null) return factory = TransformerFactory.newInstance();
LogUtil.log(Log.LEVEL_INFO, "application", "xml", factory.getClass().getName() + " is used as TransformerFactory");

return factory;
try {
return (TransformerFactory) ClassUtil.loadInstance(ClassUtil.loadClass("org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"));
}
catch (Throwable t) {
LogUtil.log("xml", t);
ExceptionUtil.rethrowIfNecessary(t);
}

try {
return (TransformerFactory) ClassUtil.loadInstance(ClassUtil.loadClass("org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"));
}
catch (Throwable t) {
LogUtil.log("xml", t);
ExceptionUtil.rethrowIfNecessary(t);
}
return TransformerFactory.newInstance();
}

public static final Document parse(InputSource xml, InputSource validator, boolean isHtml) throws SAXException, IOException {
Expand Down
2 changes: 1 addition & 1 deletion loader/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project default="core" basedir="." name="Lucee"
xmlns:resolver="antlib:org.apache.maven.resolver.ant">

<property name="version" value="6.2.0.184-SNAPSHOT"/>
<property name="version" value="6.2.0.185-SNAPSHOT"/>

<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml">
<classpath>
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.lucee</groupId>
<artifactId>lucee</artifactId>
<version>6.2.0.184-SNAPSHOT</version>
<version>6.2.0.185-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down

0 comments on commit 7b89cdc

Please sign in to comment.