jkf         2005/03/14 11:20:14

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/net Tag:
                        ANT_16_BRANCH FTP.java
               .        Tag: ANT_16_BRANCH WHATSNEW
  Log:
  PR: 28797
  
  FTP list command could crash with an ArrayIndexOutOfBoundsException.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.52.2.10 +7 -7      
ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===================================================================
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.52.2.9
  retrieving revision 1.52.2.10
  diff -u -r1.52.2.9 -r1.52.2.10
  --- FTP.java  23 Aug 2004 20:30:44 -0000      1.52.2.9
  +++ FTP.java  14 Mar 2005 19:20:13 -0000      1.52.2.10
  @@ -1842,17 +1842,17 @@
        * @throws BuildException in unknown circumstances
        */
       protected void listFile(FTPClient ftp, BufferedWriter bw, String 
filename)
  -         throws IOException, BuildException {
  +            throws IOException, BuildException {
           if (verbose) {
               log("listing " + filename);
           }
  +        FTPFile[] ftpfiles = ftp.listFiles(resolveFile(filename));
   
  -        FTPFile ftpfile = ftp.listFiles(resolveFile(filename))[0];
  -
  -        bw.write(ftpfile.toString());
  -        bw.newLine();
  -
  -        transferred++;
  +        if (ftpfiles != null && ftpfiles.length > 0) {
  +            bw.write(ftpfiles[0].toString());
  +            bw.newLine();
  +            transferred++;
  +        }
       }
   
   
  
  
  
  No                   revision
  No                   revision
  1.503.2.197 +3 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.503.2.196
  retrieving revision 1.503.2.197
  diff -u -r1.503.2.196 -r1.503.2.197
  --- WHATSNEW  14 Mar 2005 11:49:27 -0000      1.503.2.196
  +++ WHATSNEW  14 Mar 2005 19:20:14 -0000      1.503.2.197
  @@ -252,6 +252,9 @@
   
   * The VAJ tasks could fail if the project name contained characters
     that need to get URL encoded.  Bugzilla Report 23322.
  +  
  +* The FTP task could crash with an ArrayIndexOutOfBoundsException
  +  Bugzilla Report 28797
   
   Changes from Ant 1.6.1 to Ant 1.6.2
   ===================================
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to