commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 33942] New: - FTP: NoSuchMethodError thrown when sending command to disconnected FTP server
Date Wed, 09 Mar 2005 22:58:08 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=33942>.
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=33942

           Summary: FTP: NoSuchMethodError thrown when sending command to
                    disconnected FTP server
           Product: Commons
           Version: 1.3 Final
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Keywords: ErrorMessage
          Severity: critical
          Priority: P1
         Component: Net
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: aspaans@smarttime.com


- This bug only happens when running under JDK1.3.x or lower.
  (when running under JDK1.4.x or higher, this bug does not happen)
- Create and configure an FTP server. Make sure it runs OK.

- Create a program and run it under JDK1.3.x or lower:
=== Test Program ===================================
...
...
// Connect to the above FTP server and login
// Check that everything went fine.
...
while (true)
{
    try {
        FTPFile[] files = ftpClient.listFiles("*");
        showFiles(files);
    }
    catch (FTPConnectionClosedException fcce) {
        // Oops.. the FTP server has been disconnected.
        System.out.println("Disconnected from FTP Server. Ending prog.");
        break; // while(true)
    }
    Thread.sleep(3000);
}
... // close/disconnect and clean-up.
...
====================================================

- Run the above program. The ftpClient.listFiles(...) works OK.
- At some point, stop the FTP server.

=== Expected result: ===============================
Program ends normally with message "Disconnected from FTP Server. Ending prog."
====================================================

=== Actual result: =================================
Pogram throws java.lang.NoSuchMethodError.
====================================================

=== Stacktrace: ====================================
java.lang.NoSuchMethodError
	at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:442)
	at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:484)
	at org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:533)
	at org.apache.commons.net.ftp.FTP.pasv(FTP.java:833)
	at org.apache.commons.net.ftp.FTPClient._openDataConnection_
(FTPClient.java:493)
	at org.apache.commons.net.ftp.FTPClient.initiateListParsing
(FTPClient.java:2356)
	at org.apache.commons.net.ftp.FTPClient.initiateListParsing
(FTPClient.java:2330)
	at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2072)
	at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2123)
====================================================

=== Probable cause: ================================
The FTP.sendCommand(...) method, on line 442 is as follows:

    if (!isConnected() || _socket_ == null || !_socket_.isConnected())

The '_socket_' variable is of type 'java.net.Socket'.
Under JKD1.3, the 'java.net.Socket' class does NOT implement 'isConnected()'.
====================================================

Why this bug is "P1 & critical": If the FTP Server closed the connection (e.g. 
due to a time-out), our code catches the FTPConnectionClosedException exception 
and tries to reconnect to the server. If this exception is not thrown, but the 
NoSuchMethodError is thrown instead, our code fails.

PS: It is hard to find information about which JDK-versions support the 
Commons/Net component. This page (http://jakarta.apache.org/commons/net/changes-
report.html#1_3_0), indicates that the component should run correctly at least 
under JDK1.3.x.

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


Mime
View raw message