hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1787351 - /httpcomponents/httpclient/branches/pull-66/httpclient/src/main/java/org/apache/http/impl/auth/CredSspScheme.java
Date Fri, 17 Mar 2017 12:59:22 GMT
Author: kwright
Date: Fri Mar 17 12:59:22 2017
New Revision: 1787351

URL: http://svn.apache.org/viewvc?rev=1787351&view=rev
Log:
Remove a java8 dependency

Modified:
    httpcomponents/httpclient/branches/pull-66/httpclient/src/main/java/org/apache/http/impl/auth/CredSspScheme.java

Modified: httpcomponents/httpclient/branches/pull-66/httpclient/src/main/java/org/apache/http/impl/auth/CredSspScheme.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/pull-66/httpclient/src/main/java/org/apache/http/impl/auth/CredSspScheme.java?rev=1787351&r1=1787350&r2=1787351&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/pull-66/httpclient/src/main/java/org/apache/http/impl/auth/CredSspScheme.java
(original)
+++ httpcomponents/httpclient/branches/pull-66/httpclient/src/main/java/org/apache/http/impl/auth/CredSspScheme.java
Fri Mar 17 12:59:22 2017
@@ -30,13 +30,13 @@ package org.apache.http.impl.auth;
 
 import java.nio.ByteBuffer;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.security.KeyManagementException;
 import java.security.NoSuchAlgorithmException;
 import java.security.PublicKey;
 import java.security.cert.Certificate;
 import java.security.cert.CertificateException;
 import java.security.cert.X509Certificate;
-import java.util.Base64;
 import java.util.Arrays;
 
 import javax.net.ssl.SSLContext;
@@ -66,6 +66,7 @@ import org.apache.http.ssl.SSLContexts;
 import org.apache.http.util.CharArrayBuffer;
 import org.apache.http.util.CharsetUtils;
 
+import org.apache.commons.codec.binary.Base64;
 
 /**
  * <p>
@@ -731,13 +732,13 @@ public class CredSspScheme extends AuthS
         final int limit = buffer.limit();
         final byte[] bytes = new byte[limit];
         buffer.get( bytes );
-        return Base64.getEncoder().encodeToString( bytes );
+        return new String(Base64.encodeBase64(bytes), StandardCharsets.US_ASCII);
     }
 
 
     private ByteBuffer decodeBase64( final String inputString )
     {
-        final byte[] inputBytes = Base64.getDecoder().decode( inputString );
+        final byte[] inputBytes = Base64.decodeBase64(inputString.getBytes(StandardCharsets.US_ASCII));
         final ByteBuffer buffer = ByteBuffer.wrap( inputBytes );
         return buffer;
     }



Mime
View raw message