Author: sebb
Date: Thu Jun 18 22:51:26 2015
New Revision: 1686340

URL: http://svn.apache.org/r1686340
Log:
NET-575 FTPClientExample should support setting the date format

Modified:
    commons/proper/net/trunk/src/changes/changes.xml
    commons/proper/net/trunk/src/main/java/examples/ftp/FTPClientExample.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=1686340&r1=1686339&r2=1686340&view=diff
==============================================================================
--- commons/proper/net/trunk/src/changes/changes.xml [utf-8] (original)
+++ commons/proper/net/trunk/src/changes/changes.xml [utf-8] Thu Jun 18 
22:51:26 2015
@@ -72,6 +72,9 @@ This is mainly a bug-fix release. See fu
   IMAPExportMbox (example app) allows IMAP folders to be exported into an mbox 
file.
   This is the inverse of the IMAPImportMbox example added previously
         ">
+            <action issue="NET-575" type="update" dev="sebb">
+            FTPClientExample should support setting the date format
+            </action>
             <action issue="NET-538" type="fix" dev="sebb" due-to="Dzmitry">
             FTPHTTPClient should use socket factory to create sockets
             </action>

Modified: 
commons/proper/net/trunk/src/main/java/examples/ftp/FTPClientExample.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/examples/ftp/FTPClientExample.java?rev=1686340&r1=1686339&r2=1686340&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/examples/ftp/FTPClientExample.java 
(original)
+++ commons/proper/net/trunk/src/main/java/examples/ftp/FTPClientExample.java 
Thu Jun 18 22:51:26 2015
@@ -77,6 +77,8 @@ public final class FTPClientExample
         "\t-U - save unparseable responses\n" +
         "\t-w msec - wait time for keep-alive reply 
(setControlKeepAliveReplyTimeout)\n" +
         "\t-T  all|valid|none - use one of the built-in TrustManager 
implementations (none = JVM default)\n" +
+        "\t-y format - set default date format string\n" +
+        "\t-Y format - set recent date format string\n" +
         "\t-Z timezone - set the server timezone for parsing LIST responses\n" 
+
         "\t-z timezone - set the timezone for displaying MDTM, LIST, MLSD, 
MLST responses\n" +
         "\t-PrH server[:port] - HTTP Proxy host and optional port[80] \n" +
@@ -106,6 +108,8 @@ public final class FTPClientExample
         String serverTimeZoneId = null;
         String displayTimeZoneId = null;
         String serverType = null;
+        String defaultDateFormat = null;
+        String recentDateFormat = null;
 
 
         int base = 0;
@@ -182,6 +186,12 @@ public final class FTPClientExample
             else if (args[base].equals("-T")) {
                 trustmgr = args[++base];
             }
+            else if (args[base].equals("-y")) {
+                defaultDateFormat = args[++base];
+            }
+            else if (args[base].equals("-Y")) {
+                recentDateFormat = args[++base];
+            }
             else if (args[base].equals("-Z")) {
                 serverTimeZoneId = args[++base];
             }
@@ -302,6 +312,12 @@ public final class FTPClientExample
             config = new FTPClientConfig();            
         }
         config.setUnparseableEntries(saveUnparseable);
+        if (defaultDateFormat != null) {
+            config.setDefaultDateFormatStr(defaultDateFormat);
+        }
+        if (recentDateFormat != null) {
+            config.setRecentDateFormatStr(recentDateFormat);
+        }
         ftp.configure(config);
 
         try


Reply via email to