ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 29699] New: - ftp task erronously assumes FTPClient.listFiles() returns an array of length > 0
Date Sun, 20 Jun 2004 18:38:21 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=29699>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=29699

ftp task erronously assumes FTPClient.listFiles() returns an array of length > 0

           Summary: ftp task erronously assumes FTPClient.listFiles()
                    returns an array of length > 0
           Product: Ant
           Version: 1.6.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: scohen@apache.org
                CC: mr_furious1@hotmail.com


Please see
http://issues.apache.org/bugzilla/show_bug.cgi?id=29650

That bug was originally about a defect that had already been addressed in
commons-net and so it was marked as a duplicate of another bug.  However, in the
process of discussion, a different issue was raised for which I am creating a
separate bug.

This ant script

Ant script:
 		<ftp
 			action="list" 
 			server="${ftp.host}" 
 			userid="${ftp.login}" 
 			password="${ftp.password}" 
 			verbose="yes"
 			listing="xsl/listing.txt"
 		>
 		
 			<fileset>
 				<include name="**/*"/>

 			</fileset>
 		
    	</ftp>

produces this output:

BUILD FAILED
java.lang.ArrayIndexOutOfBoundsException: 0
        at org.apache.tools.ant.taskdefs.optional.net.FTP.listFile(FTP.java:1856
)
        at org.apache.tools.ant.taskdefs.optional.net.FTP.transferFiles(FTP.java
:1345)
        at org.apache.tools.ant.taskdefs.optional.net.FTP.transferFiles(FTP.java
:1388)
        at org.apache.tools.ant.taskdefs.optional.net.FTP.execute(FTP.java:2016)

        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:301)
        at org.apache.tools.ant.Target.performTasks(Target.java:328)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
        at org.apache.tools.ant.Main.runBuild(Main.java:632)
        at org.apache.tools.ant.Main.startAnt(Main.java:183)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)

Total time: 1 minute 16 seconds
java.lang.ArrayIndexOutOfBoundsException: 0
        at org.apache.tools.ant.taskdefs.optional.net.FTP.listFile(FTP.java:1856
)
        at org.apache.tools.ant.taskdefs.optional.net.FTP.transferFiles(FTP.java
:1345)
        at org.apache.tools.ant.taskdefs.optional.net.FTP.transferFiles(FTP.java
:1388)
        at org.apache.tools.ant.taskdefs.optional.net.FTP.execute(FTP.java:2016)

        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:301)
        at org.apache.tools.ant.Target.performTasks(Target.java:328)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
        at org.apache.tools.ant.Main.runBuild(Main.java:632)
        at org.apache.tools.ant.Main.startAnt(Main.java:183)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)

What I think is happening is that there are some empty directories to be found
under the tree when **/* is the specified filelist.  Since commons-net list
files does not handle recursive listings, ant must be processing each directory
found under the root of this tree separately.  The Ant code 

        FTPFile ftpfile = ftp.listFiles(resolveFile(filename))[0]; 

seems to be making an assumption that an array with a length of at least 1 will
be returned, but in actuality it is quite possible for a 0-length array to be
returned by listFiles().

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


Mime
View raw message