Author: sebb
Date: Tue Feb  7 23:23:36 2017
New Revision: 1782089

URL: http://svn.apache.org/viewvc?rev=1782089&view=rev
Log:
NET-602 Failure to parse times from SYST_L8 systems that report as "WINDOWS 
Type: L8"

Modified:
    commons/proper/net/trunk/src/changes/changes.xml
    
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClientConfig.java
    
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java

Modified: commons/proper/net/trunk/src/changes/changes.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/changes/changes.xml?rev=1782089&r1=1782088&r2=1782089&view=diff
==============================================================================
--- commons/proper/net/trunk/src/changes/changes.xml [utf-8] (original)
+++ commons/proper/net/trunk/src/changes/changes.xml [utf-8] Tue Feb  7 
23:23:36 2017
@@ -87,6 +87,9 @@ without checking it if is a space.
   The POP3Mail examples can now get password from console, stdin or an 
environment variable.
   
 ">
+            <action issue="NET-602" type="fix" dev="sebb" due-to="Ross 
Braithwaite">
+            Failure to parse times from SYST_L8 systems that report as 
"WINDOWS Type: L8"
+            </action>
             <action issue="NET-604" type="fix" dev="sebb" due-to="Frank 
Delporte">
             TFTP send & receive don't have progress indication
             </action>

Modified: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClientConfig.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClientConfig.java?rev=1782089&r1=1782088&r2=1782089&view=diff
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClientConfig.java
 (original)
+++ 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClientConfig.java
 Tue Feb  7 23:23:36 2017
@@ -351,6 +351,17 @@ public class FTPClientConfig
         this.shortMonthNames = config.shortMonthNames;
     }
 
+    public FTPClientConfig(FTPClientConfig config) {
+        this.serverSystemKey = config.serverSystemKey;
+        this.defaultDateFormatStr = config.defaultDateFormatStr;
+        this.lenientFutureDates = config.lenientFutureDates;
+        this.recentDateFormatStr = config.recentDateFormatStr;
+        this.saveUnparseableEntries = config.saveUnparseableEntries;
+        this.serverLanguageCode = config.serverLanguageCode;
+        this.serverTimeZoneId = config.serverTimeZoneId;
+        this.shortMonthNames = config.shortMonthNames;
+    }
+
     private static final Map<String, Object> LANGUAGE_CODE_MAP = new 
TreeMap<String, Object>();
     static {
 

Modified: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java?rev=1782089&r1=1782088&r2=1782089&view=diff
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
 (original)
+++ 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
 Tue Feb  7 23:23:36 2017
@@ -240,11 +240,13 @@ public class DefaultFTPFileEntryParserFa
         {
             return new NTFTPEntryParser(config);
         } else {
+            // clone the config as it may be changed by the parsers (NET-602)
+            final FTPClientConfig config2 =  (config != null) ? new 
FTPClientConfig(config) : null;
             return new CompositeFileEntryParser(new FTPFileEntryParser[]
                    {
                        new NTFTPEntryParser(config),
-                       new UnixFTPEntryParser(config,
-                               config != null && 
FTPClientConfig.SYST_UNIX_TRIM_LEADING.equals(config.getServerSystemKey()))
+                       new UnixFTPEntryParser(config2,
+                               config2 != null && 
FTPClientConfig.SYST_UNIX_TRIM_LEADING.equals(config2.getServerSystemKey()))
                    });
         }
     }
@@ -273,11 +275,13 @@ public class DefaultFTPFileEntryParserFa
         {
             return new OS400FTPEntryParser(config);
         } else {
+            // clone the config as it may be changed by the parsers (NET-602)
+            final FTPClientConfig config2 =  (config != null) ? new 
FTPClientConfig(config) : null;
             return new CompositeFileEntryParser(new FTPFileEntryParser[]
                 {
                     new OS400FTPEntryParser(config),
-                    new UnixFTPEntryParser(config,
-                            config != null && 
FTPClientConfig.SYST_UNIX_TRIM_LEADING.equals(config.getServerSystemKey()))
+                    new UnixFTPEntryParser(config2,
+                            config2 != null && 
FTPClientConfig.SYST_UNIX_TRIM_LEADING.equals(config2.getServerSystemKey()))
                 });
         }
     }


Reply via email to