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

ParserInitializationException when connecting to a Unix FTP server

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.0
    • None
    • None

    Description

      Was getting an error when connecting to one of our vendor file servers that was returning "215 UNKNOWN Type: L8" for a SYST command.

      The DefaultFTPFileEntryParserFactory does a toUpperCase on the key, which was then being compared to the constant SYST_L8.

      That constant was "Type: L8", so it could never match.

      Here's the patch (also attached as a file):

      1. This patch file was generated by NetBeans IDE # Following Index: paths are relative to: C:\Documents and Settings\robw\My Documents\NetBeansProjects\NET_2_0
      2. This patch can be applied using context Tools: Patch action on respective folder.
      3. It uses platform neutral UTF-8 encoding and \n newlines.
      4. Above lines and this line are ignored by the patching process.
        Index: src/main/java/org/apache/commons/net/ftp/FTPClientConfig.java
          • src/main/java/org/apache/commons/net/ftp/FTPClientConfig.java Base
            (BASE)
            +++ src/main/java/org/apache/commons/net/ftp/FTPClientConfig.java
            Locally Modified (Based On LOCAL)
            @@ -190,9 +190,12 @@
      • This may happen if the ftpd in question was compiled without system
      • information.
        *
        + * 2008-Aug-07 - Updated to be UPPERCASE so that the check done in
        + * createFileEntryParser will succeed.
        + *
      • @since 1.5
        */
      • public static final String SYST_L8 = "Type: L8";
        + public static final String SYST_L8 = "TYPE: L8";

      /**

      • Identifier by which an Netware-based ftp server is known throughout
        Index:
        src/test/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParse
        rFactoryTest.java

        src/test/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParse
        rFactoryTest.java Base (BASE)
        +++
        src/test/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParse
        rFactoryTest.java Locally Modified (Based On LOCAL) @@ -62,6 +62,14 @@
        parser = factory.createFileEntryParser("OS/400");
        assertTrue(parser instanceof CompositeFileEntryParser);

      + parser = factory.createFileEntryParser("AS/400");
      + assertTrue(parser instanceof CompositeFileEntryParser);
      +
      + // Added test to make sure it handles the Unix systems that
      were
      + // compiled with OS as "UNKNOWN". This test validates that the
      + // check is case-insensitive.
      + parser = factory.createFileEntryParser("UNKNOWN Type: L8");
      +
      try {
      parser =
      factory.createFileEntryParser("OS2FTPFileEntryParser");
      fail("Exception should have been thrown.
      \"OS2FTPFileEntryParser\" is not a recognized key");

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            rob@accuweaver.com Rob Weaver
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment