Issue Details (XML | Word | Printable)

Key: NET-102
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Unassigned
Reporter: Anton Spaans
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons Net

[net] FTP: NoSuchMethodError thrown when sending command to disconnected FTP server

Created: 10/Mar/05 07:58 AM   Updated: 20/Sep/07 05:31 AM
Return to search
Component/s: None
Affects Version/s: 1.3
Fix Version/s: None

Time Tracking:
Not Specified

Environment:
Operating System: Windows 2000
Platform: PC
Issue Links:
Dependency
 

Bugzilla Id: 33942


 Description  « Hide
  • 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.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Anton Spaans added a comment - 10/Mar/05 08:18 AM
I'm not sure, but it looks like that this bug is related to the fix/patch for
COM-1663 (the patch from "2004-12-30 08:57" never made it into version
1.3.Final...?).

Rory Winston added a comment - 15/Apr/05 11:01 PM
Patch applied.