Blob Blame Raw
--- a/py4j-java/src/main/java/py4j/Protocol.java	2016-03-12 20:58:42.000000000 +0100
+++ b/py4j-java/src/main/java/py4j/Protocol.java	2016-03-25 19:53:40.557619276 +0100
@@ -36,6 +36,7 @@
 import java.io.StringWriter;
 import java.lang.reflect.InvocationTargetException;
 import java.math.BigDecimal;
+import java.util.Base64;
 
 import py4j.reflection.ReflectionUtil;
 
@@ -148,7 +149,7 @@
 	 * @return
 	 */
 	public static String encodeBytes(byte[] bytes) {
-		return Base64.encodeToString(bytes, false);
+		return Base64.getEncoder().encodeToString(bytes);
 	}
 
 	/**
@@ -172,7 +173,7 @@
 	 * @return The byte array corresponding to this command part.
 	 */
 	public final static byte[] getBytes(String commandPart) {
-		return Base64.decode(commandPart.substring(1));
+		return Base64.getDecoder().decode(commandPart.substring(1));
 	}
 
 	/**
--- a/py4j-java/src/test/java/py4j/ProtocolTest.java	2016-07-10 11:30:42.000000000 +0100
+++ b/py4j-java/src/test/java/py4j/ProtocolTest.java	2016-07-10 11:38:09.651825796 +0100
@@ -32,6 +32,7 @@
 import static org.junit.Assert.*;
 
 import java.math.BigDecimal;
+import java.util.Base64;
 
 import org.junit.Test;
 
@@ -50,7 +51,7 @@
 	public void testBytes() {
 		byte[] bytes = { 1, 100, 127, 0, 60, 15, -128, -1, 14, -55 };
 		String bytesString = Protocol.encodeBytes(bytes);
-		byte[] bytes2 = Base64.decode(bytesString);
+		byte[] bytes2 = Base64.getDecoder().decode(bytesString);
 		assertArrayEquals(bytes, bytes2);
 
 		Gateway g = new Gateway(null);
--- a/py4j-java/src/main/java/py4j/GatewayServer.java	2018-07-15 21:58:36.865238048 +0200
+++ b/py4j-java/src/main/java/py4j/GatewayServer.java	2018-07-15 21:58:57.879966196 +0200
@@ -40,6 +40,7 @@
 import java.nio.charset.Charset;
 import java.security.SecureRandom;
 import java.util.ArrayList;
+import java.util.Base64;
 import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -847,7 +848,7 @@
 			SecureRandom rnd = new SecureRandom();
 			byte[] token = new byte[256 / Byte.SIZE];
 			rnd.nextBytes(token);
-			authToken = Base64.encodeToString(token, false);
+			authToken = Base64.getEncoder().encodeToString(token);
 		}
 
 		GatewayServer gatewayServer = new GatewayServerBuilder().javaPort(port).authToken(authToken).build();