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

FTPClient.getReplyString() returns wrong value after connect()

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3
    • Fix Version/s: 3.5
    • Component/s: FTP
    • Labels:
      None
    • Flags:
      Patch

      Description

      If the FTPClient's automatic server encoding detection is enabled, a FEAT command is issued in method connectAction() [indirectly via hasFeature(String)]. After that, the replyCode and _replyLines fields are stored back to their previous values in _connectAction(), but the _newReplyString flag isn't set to true. Because of that, you will then get back the reply to the FEAT command from getReplyString(), instead of the server's welcome message. Furthermore, you may get back a reply code that doesn't match that reply string. We have encountered a case when we got back reply code 220 after FTPClient.connect(), but reply string was "530 Not logged in.".

      This error can easily be fixed by adding the following line to FTPClient.java around line 944:
      _newReplyString = true;

      Patch:
      ===================================================================
      — src/org/apache/commons/net/ftp/FTPClient.java
      +++ src/org/apache/commons/net/ftp/FTPClient.java (working copy)
      @@ -941,6 +941,7 @@
      _replyLines.clear();
      _replyLines.addAll(oldReplyLines);
      _replyCode = oldReplyCode;
      + _newReplyString = true;
      }
      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ickzon Holger Rehn
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 10m
                10m
                Remaining:
                Remaining Estimate - 10m
                10m
                Logged:
                Time Spent - Not Specified
                Not Specified