commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1126692 - in /commons/proper/net/trunk/src: changes/changes.xml main/java/org/apache/commons/net/ftp/FTPClient.java
Date Mon, 23 May 2011 19:52:37 GMT
Author: sebb
Date: Mon May 23 19:52:37 2011
New Revision: 1126692

URL: http://svn.apache.org/viewvc?rev=1126692&view=rev
Log:
NET-409 FTPClient truncates file (storeFile method).
Fix bug introduced in release 3.0.

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=1126692&r1=1126691&r2=1126692&view=diff
==============================================================================
--- commons/proper/net/trunk/src/changes/changes.xml (original)
+++ commons/proper/net/trunk/src/changes/changes.xml Mon May 23 19:52:37 2011
@@ -56,6 +56,14 @@ The <action> type attribute can be add,u
      -->
 
     <body>
+        <release version="3.0.1" date="June 2011" description="
+This is a bug-fix release.
+        ">
+            <action issue="NET-409" dev="sebb" type="fix">
+            FTPClient truncates file (storeFile method).
+            Fix bug introduced in release 3.0.
+            </action>
+        </release>
         <release version="3.0" date="May 2011" description="
 This release fixes many bugs (see below), and adds new functionality:
   - basic support for IMAP and IMAPS

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=1126692&r1=1126691&r2=1126692&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 Mon May
23 19:52:37 2011
@@ -569,17 +569,19 @@ implements Configurable
                     CopyStreamEvent.UNKNOWN_STREAM_SIZE, __mergeListeners(csl),
                     false);
         }
-        finally
+        catch (IOException e)
         {
-            Util.closeQuietly(socket);
+            Util.closeQuietly(socket); // ignore close errors here
+            throw e;
         }
 
+        output.close(); // ensure the file is fully written
+        socket.close(); // done writing the file
         // Get the transfer response
         boolean ok = completePendingCommand();
         if (csl != null) {
             csl.cleanUp(); // fetch any outstanding keepalive replies
         }
-        output.close(); // we want to know about close failure
         return ok;
     }
 



Mime
View raw message