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/06/04 18:15:10 UTC

svn commit: r1489498 - in /commons/proper/net/trunk/src/main/java/org/apache/commons/net: bsd/ daytime/ finger/ ftp/ imap/ pop3/ smtp/ telnet/

Author: sebb
Date: Tue Jun  4 16:15:03 2013
New Revision: 1489498

URL: http://svn.apache.org/r1489498
Log:
Simplify (and shorten lines)

Modified:
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/bsd/RExecClient.java
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/daytime/DaytimeTCPClient.java
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/daytime/DaytimeUDPClient.java
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/finger/FingerClient.java
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Client.java
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/Telnet.java

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/bsd/RExecClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/bsd/RExecClient.java?rev=1489498&r1=1489497&r2=1489498&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/bsd/RExecClient.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/bsd/RExecClient.java Tue Jun  4 16:15:03 2013
@@ -215,11 +215,11 @@ public class RExecClient extends SocketC
             _output_.write(NULL_CHAR);
         }
 
-        _output_.write(username.getBytes(this.getCharsetName())); // Java 1.6 can use getCharset()
+        _output_.write(username.getBytes(getCharsetName())); // Java 1.6 can use getCharset()
         _output_.write(NULL_CHAR);
-        _output_.write(password.getBytes(this.getCharsetName())); // Java 1.6 can use getCharset()
+        _output_.write(password.getBytes(getCharsetName())); // Java 1.6 can use getCharset()
         _output_.write(NULL_CHAR);
-        _output_.write(command.getBytes(this.getCharsetName())); // Java 1.6 can use getCharset()
+        _output_.write(command.getBytes(getCharsetName())); // Java 1.6 can use getCharset()
         _output_.write(NULL_CHAR);
         _output_.flush();
 

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/daytime/DaytimeTCPClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/daytime/DaytimeTCPClient.java?rev=1489498&r1=1489497&r2=1489498&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/daytime/DaytimeTCPClient.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/daytime/DaytimeTCPClient.java Tue Jun  4 16:15:03 2013
@@ -71,7 +71,7 @@ public final class DaytimeTCPClient exte
         StringBuilder result = new StringBuilder(__buffer.length);
         BufferedReader reader;
 
-        reader = new BufferedReader(new InputStreamReader(_input_, this.getCharsetName())); // Java 1.6 can use getCharset()
+        reader = new BufferedReader(new InputStreamReader(_input_, getCharsetName())); // Java 1.6 can use getCharset()
 
         while (true)
         {

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/daytime/DaytimeUDPClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/daytime/DaytimeUDPClient.java?rev=1489498&r1=1489497&r2=1489498&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/daytime/DaytimeUDPClient.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/daytime/DaytimeUDPClient.java Tue Jun  4 16:15:03 2013
@@ -67,7 +67,7 @@ public final class DaytimeUDPClient exte
         _socket_.send(sendPacket);
         _socket_.receive(receivePacket);
 
-        return new String(receivePacket.getData(), 0, receivePacket.getLength(), this.getCharsetName()); // Java 1.6 can use getCharset()
+        return new String(receivePacket.getData(), 0, receivePacket.getLength(), getCharsetName()); // Java 1.6 can use getCharset()
     }
 
     /** Same as <code>getTime(host, DaytimeUDPClient.DEFAULT_PORT);</code> */

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/finger/FingerClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/finger/FingerClient.java?rev=1489498&r1=1489497&r2=1489498&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/finger/FingerClient.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/finger/FingerClient.java Tue Jun  4 16:15:03 2013
@@ -90,7 +90,7 @@ public class FingerClient extends Socket
 
         input =
             new BufferedReader(new InputStreamReader(getInputStream(longOutput,
-                               username), this.getCharsetName())); // Java 1.6 can use getCharset()
+                               username), getCharsetName())); // Java 1.6 can use getCharset()
 
         try {
             while (true)

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=1489498&r1=1489497&r2=1489498&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 Tue Jun  4 16:15:03 2013
@@ -163,7 +163,7 @@ public class FTPHTTPClient extends FTPCl
 
         List<String> response = new ArrayList<String>();
         BufferedReader reader = new BufferedReader(
-                new InputStreamReader(input, this.getCharsetName())); // Java 1.6 can use getCharset()
+                new InputStreamReader(input, getCharsetName())); // Java 1.6 can use getCharset()
 
         for (String line = reader.readLine(); line != null
         && line.length() > 0; line = reader.readLine()) {

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java?rev=1489498&r1=1489497&r2=1489498&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java Tue Jun  4 16:15:03 2013
@@ -151,7 +151,7 @@ public class AuthenticatingIMAPClient ex
                 // the server sends an empty response ("+ "), so we don't have to read it.
                 int result = sendData(
                     Base64.encodeBase64StringUnChunked(("\000" + username + "\000" + password)
-                            .getBytes(this.getCharsetName())));  // Java 1.6 can use getCharset()
+                            .getBytes(getCharsetName())));  // Java 1.6 can use getCharset()
                 if (result == IMAPReply.OK)
                 {
                     setState(IMAP.IMAPState.AUTH_STATE);
@@ -164,11 +164,11 @@ public class AuthenticatingIMAPClient ex
                 byte[] serverChallenge = Base64.decodeBase64(getReplyString().substring(2).trim());
                 // get the Mac instance
                 Mac hmac_md5 = Mac.getInstance("HmacMD5");
-                hmac_md5.init(new SecretKeySpec(password.getBytes(this.getCharsetName()), "HmacMD5")); // Java 1.6 can use getCharset()
+                hmac_md5.init(new SecretKeySpec(password.getBytes(getCharsetName()), "HmacMD5")); // Java 1.6 can use getCharset()
                 // compute the result:
-                byte[] hmacResult = _convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(this.getCharsetName()); // Java 1.6 can use getCharset()
+                byte[] hmacResult = _convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(getCharsetName()); // Java 1.6 can use getCharset()
                 // join the byte arrays to form the reply
-                byte[] usernameBytes = username.getBytes(this.getCharsetName()); // Java 1.6 can use getCharset()
+                byte[] usernameBytes = username.getBytes(getCharsetName()); // Java 1.6 can use getCharset()
                 byte[] toEncode = new byte[usernameBytes.length + 1 /* the space */ + hmacResult.length];
                 System.arraycopy(usernameBytes, 0, toEncode, 0, usernameBytes.length);
                 toEncode[usernameBytes.length] = ' ';
@@ -186,11 +186,11 @@ public class AuthenticatingIMAPClient ex
                 // the server sends fixed responses (base64("Username") and
                 // base64("Password")), so we don't have to read them.
                 if (sendData(
-                    Base64.encodeBase64StringUnChunked(username.getBytes(this.getCharsetName()))) != IMAPReply.CONT) // Java 1.6 can use getCharset()
+                    Base64.encodeBase64StringUnChunked(username.getBytes(getCharsetName()))) != IMAPReply.CONT) // Java 1.6 can use getCharset()
                 {
                     return false;
                 }
-                int result = sendData(Base64.encodeBase64StringUnChunked(password.getBytes(this.getCharsetName()))); // Java 1.6 can use getCharset()
+                int result = sendData(Base64.encodeBase64StringUnChunked(password.getBytes(getCharsetName()))); // Java 1.6 can use getCharset()
                 if (result == IMAPReply.OK)
                 {
                     setState(IMAP.IMAPState.AUTH_STATE);

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java?rev=1489498&r1=1489497&r2=1489498&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java Tue Jun  4 16:15:03 2013
@@ -77,19 +77,19 @@ public class ExtendedPOP3Client extends 
                 // the server sends an empty response ("+ "), so we don't have to read it.
                 return sendCommand(
                     new String(
-                        Base64.encodeBase64(("\000" + username + "\000" + password).getBytes(this.getCharsetName())),
-                        this.getCharsetName()) // Java 1.6 can use getCharset()
+                        Base64.encodeBase64(("\000" + username + "\000" + password).getBytes(getCharsetName())),
+                        getCharsetName()) // Java 1.6 can use getCharset()
                     ) == POP3Reply.OK;
             case CRAM_MD5:
                 // get the CRAM challenge
                 byte[] serverChallenge = Base64.decodeBase64(getReplyString().substring(2).trim());
                 // get the Mac instance
                 Mac hmac_md5 = Mac.getInstance("HmacMD5");
-                hmac_md5.init(new SecretKeySpec(password.getBytes(this.getCharsetName()), "HmacMD5")); // Java 1.6 can use getCharset()
+                hmac_md5.init(new SecretKeySpec(password.getBytes(getCharsetName()), "HmacMD5")); // Java 1.6 can use getCharset()
                 // compute the result:
-                byte[] hmacResult = _convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(this.getCharsetName()); // Java 1.6 can use getCharset()
+                byte[] hmacResult = _convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(getCharsetName()); // Java 1.6 can use getCharset()
                 // join the byte arrays to form the reply
-                byte[] usernameBytes = username.getBytes(this.getCharsetName()); // Java 1.6 can use getCharset()
+                byte[] usernameBytes = username.getBytes(getCharsetName()); // Java 1.6 can use getCharset()
                 byte[] toEncode = new byte[usernameBytes.length + 1 /* the space */ + hmacResult.length];
                 System.arraycopy(usernameBytes, 0, toEncode, 0, usernameBytes.length);
                 toEncode[usernameBytes.length] = ' ';

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Client.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Client.java?rev=1489498&r1=1489497&r2=1489498&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Client.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Client.java Tue Jun  4 16:15:03 2013
@@ -214,7 +214,7 @@ public class POP3Client extends POP3
 
         md5 = MessageDigest.getInstance("MD5");
         timestamp += secret;
-        digest = md5.digest(timestamp.getBytes(this.getCharsetName())); // Java 1.6 can use getCharset()
+        digest = md5.digest(timestamp.getBytes(getCharsetName())); // Java 1.6 can use getCharset()
         digestBuffer = new StringBuilder(128);
 
         for (i = 0; i < digest.length; i++) {

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java?rev=1489498&r1=1489497&r2=1489498&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java Tue Jun  4 16:15:03 2013
@@ -192,7 +192,7 @@ public class AuthenticatingSMTPClient ex
         {
             // the server sends an empty response ("334 "), so we don't have to read it.
             return SMTPReply.isPositiveCompletion(sendCommand(
-                    Base64.encodeBase64StringUnChunked(("\000" + username + "\000" + password).getBytes(this.getCharsetName())) // Java 1.6 can use getCharset()
+                    Base64.encodeBase64StringUnChunked(("\000" + username + "\000" + password).getBytes(getCharsetName())) // Java 1.6 can use getCharset()
                 ));
         }
         else if (method.equals(AUTH_METHOD.CRAM_MD5))
@@ -201,11 +201,11 @@ public class AuthenticatingSMTPClient ex
             byte[] serverChallenge = Base64.decodeBase64(getReplyString().substring(4).trim());
             // get the Mac instance
             Mac hmac_md5 = Mac.getInstance("HmacMD5");
-            hmac_md5.init(new SecretKeySpec(password.getBytes(this.getCharsetName()), "HmacMD5")); // Java 1.6 can use getCharset()
+            hmac_md5.init(new SecretKeySpec(password.getBytes(getCharsetName()), "HmacMD5")); // Java 1.6 can use getCharset()
             // compute the result:
-            byte[] hmacResult = _convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(this.getCharsetName()); // Java 1.6 can use getCharset()
+            byte[] hmacResult = _convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(getCharsetName()); // Java 1.6 can use getCharset()
             // join the byte arrays to form the reply
-            byte[] usernameBytes = username.getBytes(this.getCharsetName()); // Java 1.6 can use getCharset()
+            byte[] usernameBytes = username.getBytes(getCharsetName()); // Java 1.6 can use getCharset()
             byte[] toEncode = new byte[usernameBytes.length + 1 /* the space */ + hmacResult.length];
             System.arraycopy(usernameBytes, 0, toEncode, 0, usernameBytes.length);
             toEncode[usernameBytes.length] = ' ';
@@ -219,16 +219,16 @@ public class AuthenticatingSMTPClient ex
             // the server sends fixed responses (base64("Username") and
             // base64("Password")), so we don't have to read them.
             if (!SMTPReply.isPositiveIntermediate(sendCommand(
-                Base64.encodeBase64StringUnChunked(username.getBytes(this.getCharsetName()))))) { // Java 1.6 can use getCharset()
+                Base64.encodeBase64StringUnChunked(username.getBytes(getCharsetName()))))) { // Java 1.6 can use getCharset()
                 return false;
             }
             return SMTPReply.isPositiveCompletion(sendCommand(
-                Base64.encodeBase64StringUnChunked(password.getBytes(this.getCharsetName())))); // Java 1.6 can use getCharset()
+                Base64.encodeBase64StringUnChunked(password.getBytes(getCharsetName())))); // Java 1.6 can use getCharset()
         }
         else if (method.equals(AUTH_METHOD.XOAUTH))
         {
             return SMTPReply.isPositiveIntermediate(sendCommand(
-                    Base64.encodeBase64StringUnChunked(username.getBytes(this.getCharsetName())) // Java 1.6 can use getCharset()
+                    Base64.encodeBase64StringUnChunked(username.getBytes(getCharsetName())) // Java 1.6 can use getCharset()
             ));
         } else {
             return false; // safety check

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/Telnet.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/Telnet.java?rev=1489498&r1=1489497&r2=1489498&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/Telnet.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/Telnet.java Tue Jun  4 16:15:03 2013
@@ -745,7 +745,7 @@ class Telnet extends SocketClient
         {
             _output_.write(_COMMAND_SB);
             _output_.write(_COMMAND_IS);
-            _output_.write(terminalType.getBytes(this.getCharsetName())); // Java 1.6 can use getCharset()
+            _output_.write(terminalType.getBytes(getCharsetName())); // Java 1.6 can use getCharset()
             _output_.write(_COMMAND_SE);
             _output_.flush();
         }