You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2002/11/06 21:00:54 UTC

DO NOT REPLY [Bug 14310] New: - Concat throws npe if it doesn't get at least one valid file.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14310>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14310

Concat throws npe if it doesn't get at least one valid file.

           Summary: Concat throws npe if it doesn't get at least one valid
                    file.
           Product: Ant
           Version: 1.6Alpha (nightly)
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Core tasks
        AssignedTo: ant-dev@jakarta.apache.org
        ReportedBy: gus.heck@olin.edu


Basically the code tries to create a FileInputStream from the array of strings
named input, which only contains null references. I expect that an npe might
even be thrown if only one invalid file is passed in. This probably has not been
run into before because that rarely happens with filesets. 

I guess the fact that this hasn't come up before shows how (in)frequently file
lists are used with this task :) 

Reproduction:

The following build file will create an npe

<?xml version="1.0"?>
<project name="concat-test" basedir="." default="all">

<target name="all">
   <concat destfile="TESTDEST" append="true">
      <filelist dir="." files="thisfiledoesnotexist"/>
   </concat>
</target>

</project>

This is the npe output:

[gus@draco gus]$ ~/projects/jakarta-ant/dist/bin/ant -buildfile test.xml
Buildfile: test.xml

all:
   [concat] File /home/gus/thisfiledoesnotexist does not exist.

BUILD FAILED
java.lang.NullPointerException
        at java.io.File.<init>(File.java:180)
        at java.io.FileInputStream.<init>(FileInputStream.java:66)
        at org.apache.tools.ant.taskdefs.Concat.catFiles(Concat.java:350)
        at org.apache.tools.ant.taskdefs.Concat.execute(Concat.java:268)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1331)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1275)
        at org.apache.tools.ant.Main.runBuild(Main.java:614)
        at org.apache.tools.ant.Main.start(Main.java:197)
        at org.apache.tools.ant.Main.main(Main.java:235)

Total time: 1 second
java.lang.NullPointerException
        at java.io.File.<init>(File.java:180)
        at java.io.FileInputStream.<init>(FileInputStream.java:66)
        at org.apache.tools.ant.taskdefs.Concat.catFiles(Concat.java:350)
        at org.apache.tools.ant.taskdefs.Concat.execute(Concat.java:268)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1331)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1275)
        at org.apache.tools.ant.Main.runBuild(Main.java:614)
        at org.apache.tools.ant.Main.start(Main.java:197)
        at org.apache.tools.ant.Main.main(Main.java:235)

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>