Uploaded image for project: 'Commons Net'
  1. Commons Net
  2. NET-270

Incorrect error handling in method initiateListParsing of FTPClient

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0
    • 3.0
    • FTP
    • None
    • XP - java version "1.5.0_09" - FileZilla server 0.9.30beta

    Description

      In method initiateListParsing of FTPClient, errors when opening the data connection are not correctly handled.
      This leads to ignore message delivered by the server and further operation with the FTPClient instance are not valid.

      As an example, considere the attached unit test. When such an error is met, using the sendNoOp command returns false.
      Here is an output of the test:

      F:\dev\jakarta\>run org.apache.commons.vfs.provider.ftp.FTPClientUnitTest 10.0.0.x 21 /GILLES/source usr pass 5500
      Ignoring error when creating client at iteration: 1152
      Error at iteration: 1155
      java.net.SocketTimeoutException: Accept timed out
              at java.net.PlainSocketImpl.socketAccept(Native Method)
              at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
              at java.net.ServerSocket.implAccept(ServerSocket.java:450)
              at java.net.ServerSocket.accept(ServerSocket.java:421)
              at org.apache.commons.net.ftp.FTPClient._openDataConnection_(FTPClient.java:489)
              at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2296)
              at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2269)
              at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2046)
              at org.apache.commons.vfs.provider.ftp.FTPClientUnitTest.testConnectTimeoutInList(FTPClientUnitTest.java:70)
              at org.apache.commons.vfs.provider.ftp.FTPClientUnitTest.main(FTPClientUnitTest.java:110)
      Exception in thread "main" junit.framework.AssertionFailedError: NOOP failed at iteration 1155
              at junit.framework.Assert.fail(Assert.java:47)
              at junit.framework.Assert.assertTrue(Assert.java:20)
              at org.apache.commons.vfs.provider.ftp.FTPClientUnitTest.testConnectTimeoutInList(FTPClientUnitTest.java:75)
              at org.apache.commons.vfs.provider.ftp.FTPClientUnitTest.main(FTPClientUnitTest.java:110)
      

      Attachments

        1. FTPClientUnitTest.java
          2 kB
          Gilles Gaillard

        Activity

          People

            Unassigned Unassigned
            gillouxgaillard@wanadoo.fr Gilles Gaillard
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified