You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by James Burlingame <jb...@adhesive.com> on 1999/11/19 21:14:25 UTC

PATCH: ANT Copydir with missing source directory.

An Ant <copydir ...> taskdef takes a NullPointerException when
the source directory does not exist.

Here is a testcase build.xml:

<project name="TestCopydir" default="main" basedir=".">

  <property name="build.compiler" value="classic"/>

  <target name="TestCopydir">
    <copydir src="path/does/not/exist" dest="target"/>
  </target>

  <target name="main" depends="TestCopydir"/>

</project>

Here is a patch, could someone who can commit check this in?

Index: Copydir.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs/Cop
ydir.java,v
retrieving revision 1.2
diff -c -r1.2 Copydir.java
*** Copydir.java        1999/10/15 19:27:54     1.2
--- Copydir.java        1999/11/19 20:01:37
***************
*** 48,53 ****
--- 48,58 ----

      private void scanDir(File from, File to) {
        String[] list = from.list(new DesirableFilter());
+       if (list == null) {
+           project.log("Source directory " + srcDir + " does not exist.",
+               Project.MSG_WARN);
+           return;
+       }
        for (int i = 0; i < list.length; i++) {
            String filename = list[i];
            File srcFile = new File(from, filename);





Re: PATCH: ANT Copydir with missing source directory.

Posted by James Duncan Davidson <ja...@eng.sun.com>.
> An Ant <copydir ...> taskdef takes a NullPointerException when
> the source directory does not exist.

Thanks for the two patches, I'll integrate them later this weekend! :)

.duncan

-- 
James Davidson                                     duncan@eng.sun.com 
Java + XML / Portable Code + Portable Data                 !try; do()