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 2013/01/09 14:04:24 UTC

svn commit: r1430831 - in /commons/proper/net/trunk/src: changes/changes.xml main/java/org/apache/commons/net/ftp/FTPClient.java

Author: sebb
Date: Wed Jan  9 13:04:24 2013
New Revision: 1430831

URL: http://svn.apache.org/viewvc?rev=1430831&view=rev
Log:
NET-494 FTPClient.CSL.cleanUp() fails to restore timeout value on exception

Modified:
    commons/proper/net/trunk/src/changes/changes.xml
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.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=1430831&r1=1430830&r2=1430831&view=diff
==============================================================================
--- commons/proper/net/trunk/src/changes/changes.xml (original)
+++ commons/proper/net/trunk/src/changes/changes.xml Wed Jan  9 13:04:24 2013
@@ -64,6 +64,9 @@ The <action> type attribute can be add,u
     <body>
         <release version="3.3" date="TBA" description="
         ">
+            <action issue="NET-494" dev="sebb" type="fix">
+            FTPClient.CSL.cleanUp() fails to restore timeout value on exception
+            </action>
             <action issue="NET-492" dev="sebb" type="fix">
             FTPClient.printWorkingDirectory() incorrectly parses certain valid PWD command results
             </action>

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java?rev=1430831&r1=1430830&r2=1430831&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java Wed Jan  9 13:04:24 2013
@@ -650,6 +650,9 @@ implements Configurable
         catch (IOException e)
         {
             Util.closeQuietly(socket); // ignore close errors here
+            if (csl != null) {
+                csl.cleanUp(); // fetch any outstanding keepalive replies
+            }
             throw e;
         }
 
@@ -1825,11 +1828,11 @@ implements Configurable
                     false);
         } finally {
             Util.closeQuietly(socket);
+            if (csl != null) {
+                csl.cleanUp(); // fetch any outstanding keepalive replies
+            }
         }
 
-        if (csl != null) {
-            csl.cleanUp(); // fetch any outstanding keepalive replies
-        }
         // Get the transfer response
         boolean ok = completePendingCommand();
         return ok;
@@ -3580,10 +3583,13 @@ implements Configurable
         }
 
         void cleanUp() throws IOException {
-            while(notAcked-- > 0) {
-                parent.__getReplyNoReport();
+            try {
+                while(notAcked-- > 0) {
+                    parent.__getReplyNoReport();
+                }
+            } finally {
+                parent.setSoTimeout(currentSoTimeout);                
             }
-            parent.setSoTimeout(currentSoTimeout);
         }
 
     }