ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r574313 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
Date Mon, 10 Sep 2007 17:43:32 GMT
Author: jkf
Date: Mon Sep 10 10:43:31 2007
New Revision: 574313

URL: http://svn.apache.org/viewvc?rev=574313&view=rev
Log:
pr 41724: FTP task fail, FTPClient may return null in its arrays.

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=574313&r1=574312&r2=574313&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Mon Sep 10 10:43:31 2007
@@ -61,6 +61,9 @@
 
 Fixed bugs:
 -----------
+* Error in FTP task
+  Bugzilla report 41724
+
 * Regression: Locator fails with URI encoding problem when spaces in path
   Bugzilla report 42222
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java?rev=574313&r1=574312&r2=574313&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java Mon Sep 10
10:43:31 2007
@@ -371,8 +371,9 @@
                 }
                 for (int i = 0; i < newfiles.length; i++) {
                     FTPFile file = newfiles[i];
-                    if (!file.getName().equals(".")
-                         && !file.getName().equals("..")) {
+                    if (file != null 
+                            && !file.getName().equals(".")
+                            && !file.getName().equals("..")) {
                         if (isFunctioningAsDirectory(ftp, dir, file)) {
                             String name = vpath + file.getName();
                             boolean slowScanAllowed = true;
@@ -571,7 +572,7 @@
             boolean candidateFound = false;
             String target = null;
             for (int icounter = 0; icounter < array.length; icounter++) {
-                if (array[icounter].isDirectory()) {
+                if (array[icounter] != null && array[icounter].isDirectory()) {
                     if (!array[icounter].getName().equals(".")
                         && !array[icounter].getName().equals("..")) {
                         candidateFound = true;
@@ -580,7 +581,7 @@
                             + target + " where a directory called " + array[icounter].getName()
                             + " exists", Project.MSG_DEBUG);
                         for (int pcounter = 0; pcounter < array.length; pcounter++) {
-                            if (array[pcounter].getName().equals(target) && pcounter
!= icounter) {
+                            if (array[pcounter] != null && pcounter != icounter &&
target.equals(array[pcounter].getName()) ) {
                                 candidateFound = false;
                             }
                         }
@@ -719,7 +720,7 @@
                     return null;
                 }
                 for (int icounter = 0; icounter < theFiles.length; icounter++) {
-                    if (theFiles[icounter].getName().equalsIgnoreCase(soughtPathElement))
{
+                    if (theFiles[icounter] != null && theFiles[icounter].getName().equalsIgnoreCase(soughtPathElement))
{
                         return theFiles[icounter].getName();
                     }
                 }
@@ -841,12 +842,15 @@
                     return null;
                 }
                 for (int fcount = 0; fcount < theFiles.length; fcount++) {
-                     if (theFiles[fcount].getName().equals(lastpathelement)) {
-                         return theFiles[fcount];
-                     } else if (!isCaseSensitive()
-                         && theFiles[fcount].getName().equalsIgnoreCase(lastpathelement))
{
-                         return theFiles[fcount];
-                     }
+                    if (theFiles[fcount] != null) {
+                        if (theFiles[fcount].getName().equals(lastpathelement)) {
+                            return theFiles[fcount];
+                        } else if (!isCaseSensitive()
+                                && theFiles[fcount].getName().equalsIgnoreCase(
+                                        lastpathelement)) {
+                            return theFiles[fcount];
+                        }
+                    }
                 }
                 return null;
             }
@@ -1825,11 +1829,11 @@
             String fileName = localFile.getName();
             boolean found = false;
             try {
-                if (counter == 1) {
+                if (theFiles == null) {
                     theFiles = ftp.listFiles();
                 }
                 for (int counter2 = 0; counter2 < theFiles.length; counter2++) {
-                    if (theFiles[counter2].getName().equals(fileName)) {
+                    if (theFiles[counter2] != null && theFiles[counter2].getName().equals(fileName))
{
                         found = true;
                         break;
                     }



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


Mime
View raw message