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 39108] New: - FTP.java missing checks when file type is unknown
Date Sun, 26 Mar 2006 19:56:39 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=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: henrik.sorensen@balcab.ch
                CC: henrik.sorensen@balcab.ch


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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message