commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Weaver (JIRA)" <j...@apache.org>
Subject [jira] Created: (NET-231) ParserInitializationException for a couple of server types (AS/400 and UNKNOWN Type: L8)
Date Fri, 08 Aug 2008 15:41:44 GMT
ParserInitializationException for a couple of server types (AS/400 and UNKNOWN Type: L8)
----------------------------------------------------------------------------------------

                 Key: NET-231
                 URL: https://issues.apache.org/jira/browse/NET-231
             Project: Commons Net
          Issue Type: Bug
    Affects Versions: 1.5, 2.0
            Reporter: Rob Weaver
            Priority: Minor


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.

Also some systems respond as "AS/400" instead of "OS/400", so added the check for that string.

Patch below and attached for 1.5, see issue NET-320 for patch for 2.0

# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: C:\Documents and Settings\robw\My Documents\NetBeansProjects\trunk
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: src/java/org/apache/commons/net/ftp/FTPClientConfig.java
--- src/java/org/apache/commons/net/ftp/FTPClientConfig.java Base (BASE)
+++ src/java/org/apache/commons/net/ftp/FTPClientConfig.java Locally Modified (Based On LOCAL)
@@ -171,7 +171,13 @@
      */
     public static final String SYST_OS400 = "OS/400";
     
+
     /**
+     * Alternate SYST value for an AS/400 system.
+     */
+    public static final String SYST_AS400 = "AS/400";
+
+    /**
      * Identifier by which an MVS-based ftp server is known throughout
      * the commons-net ftp system.
      */
@@ -185,7 +191,7 @@
      *
      * @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/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
--- src/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java Base
(BASE)
+++ src/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java Locally
Modified (Based On LOCAL)
@@ -109,7 +109,8 @@
                 {
                     parser = createOS2FTPEntryParser();
                 }
-                else if (ukey.indexOf(FTPClientConfig.SYST_OS400) >= 0)
+                else if ((ukey.indexOf(FTPClientConfig.SYST_OS400) >= 0)
+                    || (ukey.indexOf(FTPClientConfig.SYST_AS400) >= 0))
                 {
                     parser = createOS400FTPEntryParser();
                 }
Index: src/test/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactoryTest.java
--- src/test/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactoryTest.java Base
(BASE)
+++ src/test/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactoryTest.java Locally
Modified (Based On LOCAL)
@@ -62,6 +62,15 @@
         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");


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message