ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r720773 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
Date Wed, 26 Nov 2008 09:21:18 GMT
Author: bodewig
Date: Wed Nov 26 01:21:17 2008
New Revision: 720773

URL: http://svn.apache.org/viewvc?rev=720773&view=rev
Log:
Try to load TraX factory via configured classpath.  PR 46172

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=720773&r1=720772&r2=720773&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Wed Nov 26 01:21:17 2008
@@ -296,6 +296,10 @@
    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:
 --------------
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java?rev=720773&r1=720772&r2=720773&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java Wed Nov
26 01:21:17 2008
@@ -364,7 +364,28 @@
             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);



Mime
View raw message