ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r540055 - in /ant/core/trunk/src: main/org/apache/tools/ant/types/resources/Files.java tests/antunit/types/path-test.xml
Date Mon, 21 May 2007 08:21:03 GMT
Author: jhm
Date: Mon May 21 01:21:02 2007
New Revision: 540055

URL: http://svn.apache.org/viewvc?view=rev&rev=540055
Log:
Fix Bug 42397: NPE in <path><files refid>

Added:
    ant/core/trunk/src/tests/antunit/types/path-test.xml
Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Files.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Files.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Files.java?view=diff&rev=540055&r1=540054&r2=540055
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Files.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Files.java Mon May 21 01:21:02
2007
@@ -497,8 +497,10 @@
     }
 
     private boolean hasPatterns(PatternSet ps) {
-        return ps.getIncludePatterns(getProject()).length > 0
-            || ps.getExcludePatterns(getProject()).length > 0;
+        String[] includePatterns = ps.getIncludePatterns(getProject());
+        String[] excludePatterns = ps.getExcludePatterns(getProject());
+        return (includePatterns != null && includePatterns.length > 0)
+            || (includePatterns != null && excludePatterns.length > 0);
     }
 
 }

Added: ant/core/trunk/src/tests/antunit/types/path-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/types/path-test.xml?view=auto&rev=540055
==============================================================================
--- ant/core/trunk/src/tests/antunit/types/path-test.xml (added)
+++ ant/core/trunk/src/tests/antunit/types/path-test.xml Mon May 21 01:21:02 2007
@@ -0,0 +1,25 @@
+<project xmlns:au="antlib:org.apache.ant.antunit" default="antunit">
+
+  <import file="../antunit-base.xml" />
+
+  <property name="existingFile" value="${basedir}/build.xml" />
+
+  <files id="files">
+    <include name="${existingFile}" />
+  </files>
+    
+  <target name="test-directUse" description="Bug 42397 - works fine">
+    <path id="path">
+      <files>
+        <include name="${existingFile}" />
+      </files>
+    </path>
+  </target>
+
+  <target name="test-refid" description="Bug 42397">
+    <path id="path">
+      <files refid="files" />
+    </path>
+  </target>
+
+</project>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message