Repository: incubator-livy Updated Branches: refs/heads/master 219630273 -> 551dd5c27
[HOTFIX] Fix Base64 not existed in jdk7 issue Project: http://git-wip-us.apache.org/repos/asf/incubator-livy/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-livy/commit/551dd5c2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-livy/tree/551dd5c2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-livy/diff/551dd5c2 Branch: refs/heads/master Commit: 551dd5c27f05c35c75015c7dae9153e2a7f23089 Parents: 2196302 Author: jerryshao <ss...@hortonworks.com> Authored: Wed Jun 13 11:42:40 2018 +0800 Committer: jerryshao <ss...@hortonworks.com> Committed: Wed Jun 13 11:42:40 2018 +0800 ---------------------------------------------------------------------- core/pom.xml | 5 +++++ core/src/main/scala/org/apache/livy/Utils.scala | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-livy/blob/551dd5c2/core/pom.xml ---------------------------------------------------------------------- diff --git a/core/pom.xml b/core/pom.xml index 9113cad..d06e633 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -61,6 +61,11 @@ <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency> + + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + </dependency> </dependencies> </project> http://git-wip-us.apache.org/repos/asf/incubator-livy/blob/551dd5c2/core/src/main/scala/org/apache/livy/Utils.scala ---------------------------------------------------------------------- diff --git a/core/src/main/scala/org/apache/livy/Utils.scala b/core/src/main/scala/org/apache/livy/Utils.scala index 3855679..51020e2 100644 --- a/core/src/main/scala/org/apache/livy/Utils.scala +++ b/core/src/main/scala/org/apache/livy/Utils.scala @@ -21,13 +21,15 @@ import java.io.{Closeable, File, InputStreamReader} import java.net.URL import java.nio.charset.StandardCharsets.UTF_8 import java.security.SecureRandom -import java.util.{Base64, Properties} +import java.util.Properties import scala.annotation.tailrec import scala.collection.JavaConverters._ import scala.concurrent.TimeoutException import scala.concurrent.duration.Duration +import org.apache.commons.codec.binary.Base64 + object Utils { def getPropertiesFromFile(file: File): Map[String, String] = { loadProperties(file.toURI().toURL()) @@ -111,6 +113,7 @@ object Utils { val rnd = new SecureRandom() val secretBytes = new Array[Byte](secretBitLength / java.lang.Byte.SIZE) rnd.nextBytes(secretBytes) - Base64.getEncoder.encodeToString(secretBytes) + + Base64.encodeBase64String(secretBytes) } }