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=39108>.
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=39108

           Summary: FTP.java missing checks when file type is unknown
           Product: Ant
           Version: 1.6.5
          Platform: Other
        OS/Version: other
            Status: NEW
          Keywords: PatchAvailable
          Severity: normal
          Priority: P3
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: [EMAIL PROTECTED]
                CC: [EMAIL PROTECTED]


The FTP.java class has two local methods used to check is a file entry is really
a file or a directory. The problem with the current implementation is it is not
taking into account that the entries can be unknown, and the current logic
further assumes that isFile==!isDirectory.

The two methods are
isFunctioningAsFile 
and
isFunctioningAsDirectory

I have tested the following changes to the functions:

   private boolean isFunctioningAsDirectory(FTPClient ftp, String dir, FTPFile 
file) {
        boolean result = false;
        String currentWorkingDir = null;
        if (file.isDirectory()) {
            return true;
        } else if (file.isFile()) {
            return false;
        } 
<b> else if (file.isUnknown()) {
                return false;
        }
</b>
 ...
}

    private boolean isFunctioningAsFile(FTPClient ftp, String dir, FTPFile 
file) {
        if (file.isDirectory()) {
            return false;
        } else if (file.isFile()) {
            return true;
        }<b> else if (file.isUnknown()) {
                return false;
       }</b>
        
        return !isFunctioningAsDirectory(ftp, dir, file);
    }

Henrik

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

Reply via email to