commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1228522 - /commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java
Date Sat, 07 Jan 2012 00:37:55 GMT
Author: sebb
Date: Sat Jan  7 00:37:55 2012
New Revision: 1228522

URL: http://svn.apache.org/viewvc?rev=1228522&view=rev
Log:
Simplify

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

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java?rev=1228522&r1=1228521&r2=1228522&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java Sat
Jan  7 00:37:55 2012
@@ -42,7 +42,7 @@ public class FTPHTTPClient extends FTPCl
     private final String proxyUsername;
     private final String proxyPassword;
 
-    private final byte[] CRLF;
+    private static final byte[] CRLF={'\r', '\n'};
     private final Base64 base64 = new Base64();
 
     public FTPHTTPClient(String proxyHost, int proxyPort, String proxyUser, String proxyPass)
{
@@ -50,12 +50,6 @@ public class FTPHTTPClient extends FTPCl
         this.proxyPort = proxyPort;
         this.proxyUsername = proxyUser;
         this.proxyPassword = proxyPass;
-
-        try {
-            CRLF = "\r\n".getBytes(getControlEncoding());
-        } catch (UnsupportedEncodingException e) {
-            throw new RuntimeException(e);
-        }
     }
 
     public FTPHTTPClient(String proxyHost, int proxyPort) {
@@ -66,8 +60,6 @@ public class FTPHTTPClient extends FTPCl
     @Override
     protected Socket _openDataConnection_(int command, String arg) 
     throws IOException {
-        Socket socket;
-
         //Force local passive mode, active mode not supported by through proxy
         if (getDataConnectionMode() != PASSIVE_LOCAL_DATA_CONNECTION_MODE) {
             enterLocalPassiveMode();
@@ -89,7 +81,7 @@ public class FTPHTTPClient extends FTPCl
             _parsePassiveModeReply(_replyLines.get(0));
         }
 
-        socket = new Socket(proxyHost, proxyPort);
+        Socket socket = new Socket(proxyHost, proxyPort);
         InputStream is = socket.getInputStream();
         OutputStream os = socket.getOutputStream();
         tunnelHandshake(this.getPassiveHost(), this.getPassivePort(), is, os);



Mime
View raw message