Author: jkf Date: Mon Sep 10 10:49:24 2007 New Revision: 574316 URL: http://svn.apache.org/viewvc?rev=574316&view=rev Log: Merge of pr 41724
Modified: ant/core/branches/ANT_17_BRANCH/WHATSNEW ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java Modified: ant/core/branches/ANT_17_BRANCH/WHATSNEW URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/WHATSNEW?rev=574316&r1=574315&r2=574316&view=diff ============================================================================== --- ant/core/branches/ANT_17_BRANCH/WHATSNEW (original) +++ ant/core/branches/ANT_17_BRANCH/WHATSNEW Mon Sep 10 10:49:24 2007 @@ -24,6 +24,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/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java URL: http://svn.apache.org/viewvc/ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java?rev=574316&r1=574315&r2=574316&view=diff ============================================================================== --- ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java (original) +++ ant/core/branches/ANT_17_BRANCH/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java Mon Sep 10 10:49:24 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]