commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1083202 - /commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTP.java
Date Sat, 19 Mar 2011 16:04:48 GMT
Author: sebb
Date: Sat Mar 19 16:04:47 2011
New Revision: 1083202

URL: http://svn.apache.org/viewvc?rev=1083202&view=rev
Log:
NET-382 Don't call getInputStream on _socket_, super class has already done that

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

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTP.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTP.java?rev=1083202&r1=1083201&r2=1083202&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTP.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTP.java Sat Mar 19
16:04:47 2011
@@ -24,7 +24,6 @@ import java.io.OutputStreamWriter;
 import java.net.Inet4Address;
 import java.net.Inet6Address;
 import java.net.InetAddress;
-import java.net.Socket;
 import java.net.SocketException;
 import java.util.ArrayList;
 
@@ -371,13 +370,11 @@ public class FTP extends SocketClient
     @Override
     protected void _connectAction_() throws IOException
     {
-        super._connectAction_();
+        super._connectAction_(); // sets up _input_ and _output_
         _controlInput_ =
-            new BufferedReader(new InputStreamReader(_socket_.getInputStream(),
-                                                     getControlEncoding()));
+            new BufferedReader(new InputStreamReader(_input_, getControlEncoding()));
         _controlOutput_ =
-            new BufferedWriter(new OutputStreamWriter(_socket_.getOutputStream(),
-                                                      getControlEncoding()));
+            new BufferedWriter(new OutputStreamWriter(_output_, getControlEncoding()));
         __getReply();
         // If we received code 120, we have to fetch completion reply.
         if (FTPReply.isPositivePreliminary(_replyCode))
@@ -509,7 +506,7 @@ public class FTP extends SocketClient
         }
         catch (SocketException e)
         {
-            if (!isConnected() || !socketIsConnected(_socket_))
+            if (!isConnected())
             {
                 throw new FTPConnectionClosedException("Connection unexpectedly closed.");
             }
@@ -533,21 +530,6 @@ public class FTP extends SocketClient
         __getReplyNoReport(); // This may timeout
     }
 
-    /**
-     * Checks if the socket is connected
-     *
-     * @param socket
-     * @return true if connected
-     */
-    private boolean socketIsConnected(Socket socket)
-    {
-        if (socket == null)
-        {
-            return false;
-        }
-        return socket.isConnected();
-    }
-
     /***
      * Sends an FTP command to the server, waits for a reply and returns the
      * numerical response code.  After invocation, for more detailed



Mime
View raw message