hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1438566 - in /httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth: BasicScheme.java GGSSchemeBase.java
Date Fri, 25 Jan 2013 15:55:57 GMT
Author: olegk
Date: Fri Jan 25 15:55:56 2013
New Revision: 1438566

URL: http://svn.apache.org/viewvc?rev=1438566&view=rev
Log:
HTTPCLIENT-1305: Use Base64 as a final instance variable

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/BasicScheme.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/BasicScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/BasicScheme.java?rev=1438566&r1=1438565&r2=1438566&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/BasicScheme.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/BasicScheme.java
Fri Jan 25 15:55:56 2013
@@ -55,6 +55,7 @@ import org.apache.http.util.EncodingUtil
 @NotThreadSafe
 public class BasicScheme extends RFC2617Scheme {
 
+    private final Base64 base64codec;
     /** Whether the basic authentication process is complete */
     private boolean complete;
 
@@ -63,6 +64,7 @@ public class BasicScheme extends RFC2617
      */
     public BasicScheme(final Charset credentialsCharset) {
         super(credentialsCharset);
+        this.base64codec = new Base64(0);
         this.complete = false;
     }
 
@@ -77,6 +79,7 @@ public class BasicScheme extends RFC2617
     @Deprecated
     public BasicScheme(final ChallengeState challengeState) {
         super(challengeState);
+        this.base64codec = new Base64(0);
     }
 
     public BasicScheme() {
@@ -160,7 +163,7 @@ public class BasicScheme extends RFC2617
         tmp.append(":");
         tmp.append((credentials.getPassword() == null) ? "null" : credentials.getPassword());
 
-        final byte[] base64password = Base64.encodeBase64(
+        final byte[] base64password = base64codec.encode(
                 EncodingUtils.getBytes(tmp.toString(), getCredentialsCharset(request)));
 
         final CharArrayBuffer buffer = new CharArrayBuffer(32);

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java?rev=1438566&r1=1438565&r2=1438566&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/auth/GGSSchemeBase.java
Fri Jan 25 15:55:56 2013
@@ -64,6 +64,7 @@ public abstract class GGSSchemeBase exte
 
     private final Log log = LogFactory.getLog(getClass());
 
+    private final Base64 base64codec;
     private final boolean stripPort;
 
     /** Authentication process state */
@@ -74,8 +75,9 @@ public abstract class GGSSchemeBase exte
 
     GGSSchemeBase(final boolean stripPort) {
         super();
-        this.state = State.UNINITIATED;
+        this.base64codec = new Base64(0);
         this.stripPort = stripPort;
+        this.state = State.UNINITIATED;
     }
 
     GGSSchemeBase() {
@@ -174,7 +176,7 @@ public abstract class GGSSchemeBase exte
                 throw new AuthenticationException(gsse.getMessage());
             }
         case TOKEN_GENERATED:
-            final String tokenstr = new String(Base64.encodeBase64(token, false));
+            final String tokenstr = new String(base64codec.encode(token));
             if (log.isDebugEnabled()) {
                 log.debug("Sending response '" + tokenstr + "' back to the auth server");
             }



Mime
View raw message