[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ant-dev
Subject:    DO NOT REPLY [Bug 39108]  New:  - FTP.java missing checks when file type is unknown
From:       bugzilla () apache ! org
Date:       2006-03-26 19:56:39
Message-ID: bug-39108-472 () http ! issues ! apache ! org/bugzilla/
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic