You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by kw...@apache.org on 2017/03/17 12:59:22 UTC
svn commit: r1787351 -
/httpcomponents/httpclient/branches/pull-66/httpclient/src/main/java/org/apache/http/impl/auth/CredSspScheme.java
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;
}