You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2008/11/26 06:34:33 UTC

svn commit: r720746 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java src/tests/antunit/taskdefs/xslt-test.xml

Author: bodewig
Date: Tue Nov 25 21:34:32 2008
New Revision: 720746

URL: http://svn.apache.org/viewvc?rev=720746&view=rev
Log:
fail early if stylesheet doesn't exist.  PR 34525.

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
    ant/core/trunk/src/tests/antunit/taskdefs/xslt-test.xml

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=720746&r1=720745&r2=720746&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Tue Nov 25 21:34:32 2008
@@ -548,6 +548,9 @@
    -docfilessubdirs and -excludedocfilessubdir command line arguments.
    Bugzilla Report 34455.
 
+ * <xslt> now fails early if a specified stylesheet doesn't exist.
+   Bugzilla Report 34525.
+
 Changes from Ant 1.7.0 TO Ant 1.7.1
 =============================================
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java?rev=720746&r1=720745&r2=720746&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java Tue Nov 25 21:34:32 2008
@@ -322,6 +322,12 @@
             } else {
                 styleResource = xslResource;
             }
+
+            if (!styleResource.isExists()) {
+                throw new BuildException("stylesheet " + styleResource
+                                         + " doesn't exist.");
+            }
+
             // if we have an in file and out then process them
             if (inFile != null && outFile != null) {
                 process(inFile, outFile, styleResource);

Modified: ant/core/trunk/src/tests/antunit/taskdefs/xslt-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/xslt-test.xml?rev=720746&r1=720745&r2=720746&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/xslt-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/xslt-test.xml Tue Nov 25 21:34:32 2008
@@ -66,4 +66,11 @@
        value="set='somevalue'"/>
   </target>
 
+  <target name="testStyleDoesntExist" depends="setUp">
+    <au:expectfailure expectedmessage="i-m-not-there.xslt doesn't exist.">
+      <xslt in="${legacy.dir}/data.xml"
+            out="${output}/out.xml"
+            style="i-m-not-there.xslt"/>
+    </au:expectfailure>
+  </target>
 </project>