Browse Source

Try to load TraX factory via configured classpath. PR 46172

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@720773 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 16 years ago
parent
commit
58069d3478
2 changed files with 26 additions and 1 deletions
  1. +4
    -0
      WHATSNEW
  2. +22
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java

+ 4
- 0
WHATSNEW View File

@@ -296,6 +296,10 @@ Fixed bugs:
without a name. It will now fail with a meaningful error message.
Bugzilla Report 39960.

* <xslt> now uses the configured classpath to load the factory (when
using TraX) before falling back to Ant's own classpath.
Bugzilla Report 46172.

Other changes:
--------------



+ 22
- 1
src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java View File

@@ -364,7 +364,28 @@ public class TraXLiaison implements XSLTLiaison3, ErrorListener, XSLTLoggerAware
tfactory = TransformerFactory.newInstance();
} else {
try {
Class clazz = Class.forName(factoryName);
Class clazz = null;
try {
clazz =
Class.forName(factoryName, true,
Thread.currentThread()
.getContextClassLoader());
} catch (ClassNotFoundException cnfe) {
String msg = "Failed to load " + factoryName
+ " via the configured classpath, will try"
+ " Ant's classpath instead.";
if (logger != null) {
logger.log(msg);
} else if (project != null) {
project.log(msg, Project.MSG_WARN);
} else {
System.err.println(msg);
}
}

if (clazz == null) {
clazz = Class.forName(factoryName);
}
tfactory = (TransformerFactory) clazz.newInstance();
} catch (Exception e) {
throw new BuildException(e);


Loading…
Cancel
Save