You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2011/04/18 14:55:20 UTC

svn commit: r1094552 - /commons/proper/net/trunk/src/main/java/examples/ftp/FTPClientExample.java

Author: sebb
Date: Mon Apr 18 12:55:20 2011
New Revision: 1094552

URL: http://svn.apache.org/viewvc?rev=1094552&view=rev
Log:
Implement lenient future dates option

Modified:
    commons/proper/net/trunk/src/main/java/examples/ftp/FTPClientExample.java

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=1094552&r1=1094551&r2=1094552&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 Mon Apr 18 12:55:20 2011
@@ -59,6 +59,7 @@ public final class FTPClientExample
         "\t-h - list hidden files (applies to -l and -n only)\n" +
         "\t-k secs - use keep-alive timer (setControlKeepAliveTimeout)\n" +
         "\t-l - list files using LIST (remote is used as the pathname if provided)\n" +
+        "\t-L - use lenient future dates (server dates may be up to 1 day into future)\n" +
         "\t-n - list file names using NLST (remote is used as the pathname if provided)\n" +
         "\t-p true|false|protocol[,true|false] - use FTPSClient with the specified protocol and/or isImplicit setting\n" +
         "\t-s - store file on server (upload)\n" +
@@ -72,6 +73,7 @@ public final class FTPClientExample
         boolean storeFile = false, binaryTransfer = false, error = false, listFiles = false, listNames = false, hidden = false;
         boolean localActive = false, useEpsvWithIPv4 = false, feat = false, printHash = false;
         boolean mlst = false, mlsd = false;
+        boolean lenient = false;
         long keepAliveTimeout = -1;
         int controlKeepAliveReplyTimeout = -1;
         int minParams = 5; // listings require 3 params
@@ -116,6 +118,9 @@ public final class FTPClientExample
                 listFiles = true;
                 minParams = 3;
             }
+            else if (args[base].equals("-L")) {
+                lenient = true;
+            }
             else if (args[base].equals("-n")) {
                 listNames = true;
                 minParams = 3;
@@ -285,6 +290,12 @@ __main:
             }
             else if (listFiles)
             {
+                if (lenient) {
+                    FTPClientConfig config = new FTPClientConfig();
+                    config.setLenientFutureDates(true);
+                    ftp.configure(config );
+                }
+
                 for (FTPFile f : ftp.listFiles(remote)) {
                     System.out.println(f.getRawListing());
                     System.out.println(f.toFormattedString());