commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1490204 - /commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java
Date Thu, 06 Jun 2013 09:03:26 GMT
Author: sebb
Date: Thu Jun  6 09:03:25 2013
New Revision: 1490204

URL: http://svn.apache.org/r1490204
Log:
Simplify and elimimate resource not closed warnings

Modified:
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPClient.java

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=1490204&r1=1490203&r2=1490204&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 Thu Jun
 6 09:03:25 2013
@@ -636,12 +636,10 @@ implements Configurable
             return false;
         }
 
-        OutputStream output;
+        OutputStream output = getBufferedOutputStream(socket.getOutputStream());
 
         if (__fileType == ASCII_FILE_TYPE) {
-            output = new ToNetASCIIOutputStream(getBufferedOutputStream(socket.getOutputStream()));
-        } else {
-            output = getBufferedOutputStream(socket.getOutputStream());
+            output = new ToNetASCIIOutputStream(output);
         }
 
         CSL csl = null;
@@ -1859,11 +1857,9 @@ implements Configurable
             return false;
         }
 
-        InputStream input;
+        InputStream input = getBufferedInputStream(socket.getInputStream());
         if (__fileType == ASCII_FILE_TYPE) {
-            input = new FromNetASCIIInputStream(getBufferedInputStream(socket.getInputStream()));
-        } else {
-            input = getBufferedInputStream(socket.getInputStream());
+            input = new FromNetASCIIInputStream(input);
         }
 
         CSL csl = null;
@@ -1878,6 +1874,7 @@ implements Configurable
                     CopyStreamEvent.UNKNOWN_STREAM_SIZE, __mergeListeners(csl),
                     false);
         } finally {
+            Util.closeQuietly(input);
             Util.closeQuietly(socket);
             if (csl != null) {
                 csl.cleanUp(); // fetch any outstanding keepalive replies



Mime
View raw message