You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by rg...@apache.org on 2009/11/06 18:38:44 UTC

svn commit: r833482 - in /commons/proper/vfs/trunk: core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpClientFactory.java core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java xdocs/changes.xml

Author: rgoers
Date: Fri Nov  6 17:38:44 2009
New Revision: 833482

URL: http://svn.apache.org/viewvc?rev=833482&view=rev
Log:
Apply patch for VFS-216 provided by Reetu Mutti

Modified:
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpClientFactory.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java
    commons/proper/vfs/trunk/xdocs/changes.xml

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpClientFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpClientFactory.java?rev=833482&r1=833481&r2=833482&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpClientFactory.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpClientFactory.java Fri Nov  6 17:38:44 2009
@@ -157,6 +157,12 @@
                     client.setDataTimeout(dataTimeout.intValue());
                 }
 
+                Integer socketTimeout = FtpFileSystemConfigBuilder.getInstance().getSoTimeout(fileSystemOptions);
+                if (socketTimeout != null)
+                {
+                    client.setSoTimeout(socketTimeout.intValue());
+                }
+
                 // Change to root by default
                 // All file operations a relative to the filesystem-root
                 // String root = getRoot().getName().getPath();

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java?rev=833482&r1=833481&r2=833482&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemConfigBuilder.java Fri Nov  6 17:38:44 2009
@@ -34,6 +34,7 @@
     private static final String PASSIVE_MODE = FtpFileSystemConfigBuilder.class.getName() + ".PASSIVE";
     private static final String USER_DIR_IS_ROOT = FtpFileSystemConfigBuilder.class.getName() + ".USER_DIR_IS_ROOT";
     private static final String DATA_TIMEOUT = FtpFileSystemConfigBuilder.class.getName() + ".DATA_TIMEOUT";
+    private final static String SO_TIMEOUT = FtpFileSystemConfigBuilder.class.getName() + ".SO_TIMEOUT";
 
     private static final String SERVER_LANGUAGE_CODE =
             FtpFileSystemConfigBuilder.class.getName() + ".SERVER_LANGUAGE_CODE";
@@ -173,6 +174,28 @@
     }
 
     /**
+     * @param opts
+     * @see #getDataTimeout
+     */
+    public Integer getSoTimeout(FileSystemOptions opts)
+    {
+        return (Integer) getParam(opts, SO_TIMEOUT);
+    }
+
+    /**
+     * set the socket timeout for the ftp client.<br />
+     * If you set the socketTimeout to <code>null</code> no socketTimeout will be set on the
+     * ftp client.
+     *
+     * @param opts
+     * @param soTimeout
+     */
+    public void setSoTimeout(FileSystemOptions opts, Integer soTimeout)
+    {
+        setParam(opts, SO_TIMEOUT, soTimeout);
+    }
+
+    /**
      * get the language code used by the server. see {@link org.apache.commons.net.ftp.FTPClientConfig}
      * for details and examples.
      * @param opts The FilesystemOptions.

Modified: commons/proper/vfs/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/xdocs/changes.xml?rev=833482&r1=833481&r2=833482&view=diff
==============================================================================
--- commons/proper/vfs/trunk/xdocs/changes.xml (original)
+++ commons/proper/vfs/trunk/xdocs/changes.xml Fri Nov  6 17:38:44 2009
@@ -23,6 +23,10 @@
 
   <body>
     <release version="2.0" date="in SVN" description="">
+      <action dev="rgoers" type="fix" issue="VFS-216" due-to="Reetu Mutti">
+        The FTP Configuration includes an option to set a timeout for the data connection, but not for the socket 
+        timeout. This is a problem, as idle sockets can cause your download to hang forever and never timeout.
+      </action>
       <action dev="rgoers" type="fix" issue="VFS-289" due-to="Kirill Safonov">
         FTP connection is not released If exception is thrown out of FtpFileObject.doGetOutputStream().
       </action>