commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1395018 - in /commons/proper/net/trunk/src/main/java/org/apache/commons/net: ftp/FTPSClient.java imap/AuthenticatingIMAPClient.java pop3/ExtendedPOP3Client.java smtp/AuthenticatingSMTPClient.java
Date Sat, 06 Oct 2012 12:10:08 GMT
Author: sebb
Date: Sat Oct  6 12:10:08 2012
New Revision: 1395018

URL: http://svn.apache.org/viewvc?rev=1395018&view=rev
Log:
Simplify by using the new Base64 method to create the String output

Modified:
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPSClient.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/smtp/AuthenticatingSMTPClient.java

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPSClient.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPSClient.java?rev=1395018&r1=1395017&r2=1395018&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPSClient.java (original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPSClient.java Sat
Oct  6 12:10:08 2012
@@ -695,7 +695,7 @@ public class FTPSClient extends FTPClien
     {
         if (data != null)
         {
-            return sendCommand(CMD_ADAT, new String(Base64.encodeBase64(data)));
+            return sendCommand(CMD_ADAT, Base64.encodeBase64StringUnChunked(data));
         }
         else
         {
@@ -741,7 +741,7 @@ public class FTPSClient extends FTPClien
     {
         if (data != null)
         {
-            return sendCommand(CMD_MIC, new String(Base64.encodeBase64(data)));
+            return sendCommand(CMD_MIC, Base64.encodeBase64StringUnChunked(data));
         }
         else
         {
@@ -761,7 +761,7 @@ public class FTPSClient extends FTPClien
     {
         if (data != null)
         {
-            return sendCommand(CMD_CONF, new String(Base64.encodeBase64(data)));
+            return sendCommand(CMD_CONF, Base64.encodeBase64StringUnChunked(data));
         }
         else
         {
@@ -781,7 +781,7 @@ public class FTPSClient extends FTPClien
     {
         if (data != null)
         {
-            return sendCommand(CMD_ENC, new String(Base64.encodeBase64(data)));
+            return sendCommand(CMD_ENC, Base64.encodeBase64StringUnChunked(data));
         }
         else
         {

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=1395018&r1=1395017&r2=1395018&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
Sat Oct  6 12:10:08 2012
@@ -176,7 +176,7 @@ public class AuthenticatingIMAPClient ex
                 toEncode[usernameBytes.length] = ' ';
                 System.arraycopy(hmacResult, 0, toEncode, usernameBytes.length + 1, hmacResult.length);
                 // send the reply and read the server code:
-                int result = sendData(new String(Base64.encodeBase64(toEncode)));
+                int result = sendData(Base64.encodeBase64StringUnChunked(toEncode));
                 if (result == IMAPReply.OK)
                 {
                     setState(IMAP.IMAPState.AUTH_STATE);
@@ -188,12 +188,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(
-                    new String(Base64.encodeBase64(username.getBytes()))) != IMAPReply.CONT)
+                    Base64.encodeBase64StringUnChunked(username.getBytes())) != IMAPReply.CONT)
                 {
                     return false;
                 }
-                int result = sendData(
-                    new String(Base64.encodeBase64(password.getBytes())));
+                int result = sendData(Base64.encodeBase64StringUnChunked(password.getBytes()));
                 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=1395018&r1=1395017&r2=1395018&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
Sat Oct  6 12:10:08 2012
@@ -95,7 +95,7 @@ public class ExtendedPOP3Client extends 
                 toEncode[usernameBytes.length] = ' ';
                 System.arraycopy(hmacResult, 0, toEncode, usernameBytes.length + 1, hmacResult.length);
                 // send the reply and read the server code:
-                return sendCommand(new String(Base64.encodeBase64(toEncode))) == POP3Reply.OK;
+                return sendCommand(Base64.encodeBase64StringUnChunked(toEncode)) == POP3Reply.OK;
             default:
                 return false;
         }

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=1395018&r1=1395017&r2=1395018&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
Sat Oct  6 12:10:08 2012
@@ -174,9 +174,7 @@ public class AuthenticatingSMTPClient ex
         {
             // the server sends an empty response ("334 "), so we don't have to read it.
             return SMTPReply.isPositiveCompletion(sendCommand(
-                new String(
-                    Base64.encodeBase64(("\000" + username + "\000" + password).getBytes())
-                    )
+                    Base64.encodeBase64StringUnChunked(("\000" + username + "\000" + password).getBytes())
                 ));
         }
         else if (method.equals(AUTH_METHOD.CRAM_MD5))
@@ -196,18 +194,18 @@ public class AuthenticatingSMTPClient ex
             System.arraycopy(hmacResult, 0, toEncode, usernameBytes.length + 1, hmacResult.length);
             // send the reply and read the server code:
             return SMTPReply.isPositiveCompletion(sendCommand(
-                new String(Base64.encodeBase64(toEncode))));
+                Base64.encodeBase64StringUnChunked(toEncode)));
         }
         else if (method.equals(AUTH_METHOD.LOGIN))
         {
             // the server sends fixed responses (base64("Username") and
             // base64("Password")), so we don't have to read them.
             if (!SMTPReply.isPositiveIntermediate(sendCommand(
-                new String(Base64.encodeBase64(username.getBytes()))))) {
+                Base64.encodeBase64StringUnChunked(username.getBytes())))) {
                 return false;
             }
             return SMTPReply.isPositiveCompletion(sendCommand(
-                new String(Base64.encodeBase64(password.getBytes()))));
+                Base64.encodeBase64StringUnChunked(password.getBytes())));
         } else {
             return false; // safety check
         }



Mime
View raw message