This is an automated email from the ASF dual-hosted git repository.

yao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new d6bbe32  [KYUUBI #1981] Remove unused artifacts for common and parent 
module
d6bbe32 is described below

commit d6bbe32a01f04b903bf8378952144a3b34e71a54
Author: Kent Yao <[email protected]>
AuthorDate: Tue Mar 1 13:35:49 2022 +0800

    [KYUUBI #1981] Remove unused artifacts for common and parent module
    
    ### _Why are the changes needed?_
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including 
negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [ ] [Run 
test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests)
 locally before make a pull request
    
    Closes #1981 from yaooqinn/branch-dep.
    
    Closes #1981
    
    07bf0e29 [Kent Yao] codec
    96e41e7d [Kent Yao] codec
    1da26432 [Kent Yao] guava
    6cf0abb3 [Kent Yao] base64 & sha1
    3b45ec2a [Kent Yao] base64
    5490cfa7 [Kent Yao] http
    6f4b48b8 [Kent Yao] n
    2a87a4cf [Kent Yao] d
    a5ad3ccc [Kent Yao] Refine Deps in common module
    24d5299e [Kent Yao] Refine Deps in common module
    
    Authored-by: Kent Yao <[email protected]>
    Signed-off-by: Kent Yao <[email protected]>
---
 dev/dependencyList                                  |  3 ---
 kyuubi-common/pom.xml                               | 21 ++++++---------------
 .../HadoopThriftAuthBridgeServer.scala              |  4 ++--
 .../org/apache/kyuubi/util/KyuubiHadoopUtils.scala  |  9 +++------
 kyuubi-ha/pom.xml                                   |  5 +++++
 kyuubi-hive-jdbc-shaded/pom.xml                     |  1 -
 .../apache/kyuubi/jdbc/hive/KyuubiConnection.java   |  5 ++---
 .../apache/kyuubi/jdbc/hive/KyuubiStatement.java    |  9 ++-------
 .../kyuubi/metrics/PrometheusReporterService.scala  |  3 +--
 .../server/KyuubiTBinaryFrontendService.scala       |  7 ++++---
 .../mysql/authentication/MySQLNativePassword.scala  | 15 ++++++++-------
 kyuubi-zookeeper/pom.xml                            |  6 ++++++
 pom.xml                                             | 15 ++++++++-------
 13 files changed, 47 insertions(+), 56 deletions(-)

diff --git a/dev/dependencyList b/dev/dependencyList
index c42ee23..d883b29 100644
--- a/dev/dependencyList
+++ b/dev/dependencyList
@@ -17,7 +17,6 @@
 
 aopalliance-repackaged/2.6.1//aopalliance-repackaged-2.6.1.jar
 classgraph/4.8.95//classgraph-4.8.95.jar
-commons-codec/1.15//commons-codec-1.15.jar
 commons-lang/2.6//commons-lang-2.6.jar
 commons-lang3/3.10//commons-lang3-3.10.jar
 curator-client/2.12.0//curator-client-2.12.0.jar
@@ -36,8 +35,6 @@ hk2-api/2.6.1//hk2-api-2.6.1.jar
 hk2-locator/2.6.1//hk2-locator-2.6.1.jar
 hk2-utils/2.6.1//hk2-utils-2.6.1.jar
 htrace-core4/4.1.0-incubating//htrace-core4-4.1.0-incubating.jar
-httpclient/4.5.13//httpclient-4.5.13.jar
-httpcore/4.4.15//httpcore-4.4.15.jar
 jackson-annotations/2.13.1//jackson-annotations-2.13.1.jar
 jackson-core/2.13.1//jackson-core-2.13.1.jar
 jackson-databind/2.13.1//jackson-databind-2.13.1.jar
diff --git a/kyuubi-common/pom.xml b/kyuubi-common/pom.xml
index 173f1a6..b1efef1 100644
--- a/kyuubi-common/pom.xml
+++ b/kyuubi-common/pom.xml
@@ -77,11 +77,12 @@
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-client-runtime</artifactId>
             <scope>runtime</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>commons-codec</groupId>
-            <artifactId>commons-codec</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.google.code.findbugs</groupId>
+                    <artifactId>jsr305</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <dependency>
@@ -90,11 +91,6 @@
         </dependency>
 
         <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-        </dependency>
-
-        <dependency>
             <groupId>org.apache.thrift</groupId>
             <artifactId>libfb303</artifactId>
         </dependency>
@@ -110,11 +106,6 @@
         </dependency>
 
         <dependency>
-            <groupId>jakarta.xml.bind</groupId>
-            <artifactId>jakarta.xml.bind-api</artifactId>
-        </dependency>
-
-        <dependency>
             <groupId>com.fasterxml.jackson.module</groupId>
             
<artifactId>jackson-module-scala_${scala.binary.version}</artifactId>
         </dependency>
diff --git 
a/kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/HadoopThriftAuthBridgeServer.scala
 
b/kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/HadoopThriftAuthBridgeServer.scala
index 9589774..53d8e18 100644
--- 
a/kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/HadoopThriftAuthBridgeServer.scala
+++ 
b/kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/HadoopThriftAuthBridgeServer.scala
@@ -20,10 +20,10 @@ package org.apache.kyuubi.service.authentication
 import java.io.IOException
 import java.net.InetAddress
 import java.security.PrivilegedAction
+import java.util.Base64
 import javax.security.auth.callback._
 import javax.security.sasl.{AuthorizeCallback, RealmCallback}
 
-import org.apache.commons.codec.binary.Base64
 import org.apache.hadoop.fs.FileSystem
 import org.apache.hadoop.security.{SaslRpcServer, UserGroupInformation}
 import org.apache.hadoop.security.SaslRpcServer.AuthMethod
@@ -190,7 +190,7 @@ object HadoopThriftAuthBridgeServer {
 
     def getPasswd(identifier: KyuubiDelegationTokenIdentifier): Array[Char] = {
       val passwd = secretMgr.retrievePassword(identifier)
-      new String(Base64.encodeBase64(passwd)).toCharArray
+      Base64.getMimeEncoder.encodeToString(passwd).toCharArray
     }
 
     override def handle(callbacks: Array[Callback]): Unit = {
diff --git 
a/kyuubi-common/src/main/scala/org/apache/kyuubi/util/KyuubiHadoopUtils.scala 
b/kyuubi-common/src/main/scala/org/apache/kyuubi/util/KyuubiHadoopUtils.scala
index 0dbbec0..85a7d65 100644
--- 
a/kyuubi-common/src/main/scala/org/apache/kyuubi/util/KyuubiHadoopUtils.scala
+++ 
b/kyuubi-common/src/main/scala/org/apache/kyuubi/util/KyuubiHadoopUtils.scala
@@ -18,11 +18,10 @@
 package org.apache.kyuubi.util
 
 import java.io.{ByteArrayInputStream, ByteArrayOutputStream, DataInputStream, 
DataOutputStream}
-import java.util.{Map => JMap}
+import java.util.{Base64, Map => JMap}
 
 import scala.collection.JavaConverters._
 
-import org.apache.commons.codec.binary.Base64
 import org.apache.hadoop.conf.Configuration
 import 
org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier
 import org.apache.hadoop.io.Text
@@ -58,13 +57,11 @@ object KyuubiHadoopUtils {
     val byteStream = new ByteArrayOutputStream
     creds.writeTokenStorageToStream(new DataOutputStream(byteStream))
 
-    val encoder = new Base64(0, null, false)
-    encoder.encodeToString(byteStream.toByteArray)
+    Base64.getMimeEncoder.encodeToString(byteStream.toByteArray)
   }
 
   def decodeCredentials(newValue: String): Credentials = {
-    val decoder = new Base64(0, null, false)
-    val decoded = decoder.decode(newValue)
+    val decoded = Base64.getMimeDecoder.decode(newValue)
 
     val byteStream = new ByteArrayInputStream(decoded)
     val creds = new Credentials()
diff --git a/kyuubi-ha/pom.xml b/kyuubi-ha/pom.xml
index be6cf74..e038fed 100644
--- a/kyuubi-ha/pom.xml
+++ b/kyuubi-ha/pom.xml
@@ -55,6 +55,11 @@
         </dependency>
 
         <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
+
+        <dependency>
             <groupId>org.apache.kyuubi</groupId>
             <artifactId>kyuubi-common_${scala.binary.version}</artifactId>
             <version>${project.version}</version>
diff --git a/kyuubi-hive-jdbc-shaded/pom.xml b/kyuubi-hive-jdbc-shaded/pom.xml
index c9ae789..22e9b8e 100644
--- a/kyuubi-hive-jdbc-shaded/pom.xml
+++ b/kyuubi-hive-jdbc-shaded/pom.xml
@@ -151,7 +151,6 @@
         <dependency>
             <groupId>commons-codec</groupId>
             <artifactId>commons-codec</artifactId>
-            <version>${hive.client.commons-codec.version}</version>
         </dependency>
 
         <dependency>
diff --git 
a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java
 
b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java
index 67b4ca7..8f1df85 100644
--- 
a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java
+++ 
b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java
@@ -36,7 +36,6 @@ import javax.net.ssl.SSLContext;
 import javax.net.ssl.TrustManagerFactory;
 import javax.security.sasl.Sasl;
 import javax.security.sasl.SaslException;
-import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang.StringUtils;
 import org.apache.hadoop.hive.common.auth.HiveAuthUtils;
 import org.apache.hive.service.auth.HiveAuthFactory;
@@ -787,8 +786,8 @@ public class KyuubiConnection implements 
java.sql.Connection, KyuubiLoggable {
 
       if (launchEngineOpHandleGuid != null && launchEngineOpHandleSecret != 
null) {
         try {
-          byte[] guidBytes = Base64.decodeBase64(launchEngineOpHandleGuid);
-          byte[] secretBytes = Base64.decodeBase64(launchEngineOpHandleSecret);
+          byte[] guidBytes = 
Base64.getMimeDecoder().decode(launchEngineOpHandleGuid);
+          byte[] secretBytes = 
Base64.getMimeDecoder().decode(launchEngineOpHandleSecret);
           THandleIdentifier handleIdentifier =
               new THandleIdentifier(ByteBuffer.wrap(guidBytes), 
ByteBuffer.wrap(secretBytes));
           launchEngineOpHandle =
diff --git 
a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiStatement.java
 
b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiStatement.java
index 1e75077..b87f67f 100644
--- 
a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiStatement.java
+++ 
b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiStatement.java
@@ -23,12 +23,7 @@ import java.sql.SQLException;
 import java.sql.SQLFeatureNotSupportedException;
 import java.sql.SQLTimeoutException;
 import java.sql.SQLWarning;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.codec.binary.Base64;
+import java.util.*;
 import org.apache.hive.service.cli.RowSet;
 import org.apache.hive.service.cli.RowSetFactory;
 import org.apache.hive.service.rpc.thrift.TCLIService;
@@ -988,7 +983,7 @@ public class KyuubiStatement implements java.sql.Statement, 
KyuubiLoggable {
       // Set on the server side.
       // @see org.apache.hive.service.cli.operation.SQLOperation#prepare
       String guid64 =
-          
Base64.encodeBase64URLSafeString(stmtHandle.getOperationId().getGuid()).trim();
+          
Base64.getUrlEncoder().encodeToString(stmtHandle.getOperationId().getGuid()).trim();
       return guid64;
     }
     return null;
diff --git 
a/kyuubi-metrics/src/main/scala/org/apache/kyuubi/metrics/PrometheusReporterService.scala
 
b/kyuubi-metrics/src/main/scala/org/apache/kyuubi/metrics/PrometheusReporterService.scala
index 5da1fa2..ab014ca 100644
--- 
a/kyuubi-metrics/src/main/scala/org/apache/kyuubi/metrics/PrometheusReporterService.scala
+++ 
b/kyuubi-metrics/src/main/scala/org/apache/kyuubi/metrics/PrometheusReporterService.scala
@@ -18,7 +18,6 @@
 package org.apache.kyuubi.metrics
 
 import com.codahale.metrics.MetricRegistry
-import com.google.common.annotations.VisibleForTesting
 import io.prometheus.client.CollectorRegistry
 import io.prometheus.client.dropwizard.DropwizardExports
 import io.prometheus.client.exporter.MetricsServlet
@@ -34,7 +33,7 @@ class PrometheusReporterService(registry: MetricRegistry)
 
   private val bridgeRegistry = new CollectorRegistry
 
-  @VisibleForTesting
+  // VisibleForTesting
   private[metrics] var httpServer: Server = _
   @volatile protected var isStarted = false
 
diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendService.scala
 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendService.scala
index 86df1e8..847fd9d 100644
--- 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendService.scala
+++ 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendService.scala
@@ -17,7 +17,8 @@
 
 package org.apache.kyuubi.server
 
-import org.apache.commons.codec.binary.Base64
+import java.util.Base64
+
 import org.apache.hive.service.rpc.thrift.{TOpenSessionReq, TOpenSessionResp}
 
 import org.apache.kyuubi.KyuubiSQLException
@@ -52,10 +53,10 @@ final class KyuubiTBinaryFrontendService(
       val opHandleIdentifier = 
launchEngineOp.getHandle.identifier.toTHandleIdentifier
       respConfiguration.put(
         "kyuubi.session.engine.launch.handle.guid",
-        Base64.encodeBase64String(opHandleIdentifier.getGuid))
+        Base64.getMimeEncoder.encodeToString(opHandleIdentifier.getGuid))
       respConfiguration.put(
         "kyuubi.session.engine.launch.handle.secret",
-        Base64.encodeBase64String(opHandleIdentifier.getSecret))
+        Base64.getMimeEncoder.encodeToString(opHandleIdentifier.getSecret))
 
       resp.setSessionHandle(sessionHandle.toTSessionHandle)
       resp.setConfiguration(respConfiguration)
diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/authentication/MySQLNativePassword.scala
 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/authentication/MySQLNativePassword.scala
index c2102eb..c7d004c 100644
--- 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/authentication/MySQLNativePassword.scala
+++ 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/authentication/MySQLNativePassword.scala
@@ -17,9 +17,9 @@
 
 package org.apache.kyuubi.server.mysql.authentication
 
-import java.util
-
-import org.apache.commons.codec.digest.DigestUtils
+import java.nio.charset.StandardCharsets
+import java.security.MessageDigest
+import java.util.Arrays
 
 import 
org.apache.kyuubi.server.mysql.authentication.MySQLAuthentication.randomBytes
 import 
org.apache.kyuubi.server.mysql.authentication.MySQLNativePassword.PluginData
@@ -52,16 +52,17 @@ class MySQLNativePassword {
   }
 
   private[authentication] def isPasswordRight(password: String, 
authentication: Array[Byte]) =
-    util.Arrays.equals(getAuthCipherBytes(password), authentication)
+    Arrays.equals(getAuthCipherBytes(password), authentication)
 
   private def getAuthCipherBytes(password: String): Array[Byte] = {
     val salt = pluginData.full
-    val passwordSha1 = DigestUtils.sha1(password)
-    val passwordSha1Sha1 = DigestUtils.sha1(passwordSha1)
+    val sha1 = MessageDigest.getInstance("SHA-1")
+    val passwordSha1 = sha1.digest(password.getBytes(StandardCharsets.UTF_8))
+    val passwordSha1Sha1 = sha1.digest(passwordSha1)
     val secret = new Array[Byte](salt.length + passwordSha1Sha1.length)
     System.arraycopy(salt, 0, secret, 0, salt.length)
     System.arraycopy(passwordSha1Sha1, 0, secret, salt.length, 
passwordSha1Sha1.length)
-    val secretSha1 = DigestUtils.sha1(secret)
+    val secretSha1 = sha1.digest(secret)
     xor(passwordSha1, secretSha1)
   }
 
diff --git a/kyuubi-zookeeper/pom.xml b/kyuubi-zookeeper/pom.xml
index 50badfa..88c3089 100644
--- a/kyuubi-zookeeper/pom.xml
+++ b/kyuubi-zookeeper/pom.xml
@@ -68,6 +68,12 @@
             <artifactId>curator-client</artifactId>
             <scope>test</scope>
         </dependency>
+
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/pom.xml b/pom.xml
index e9742bb..fc72450 100644
--- a/pom.xml
+++ b/pom.xml
@@ -151,7 +151,6 @@
 
         <!-- apply to kyuubi-hive-jdbc/kyuubi-hive-beeline module -->
         <hive.client.commons-cli.version>1.2</hive.client.commons-cli.version>
-        
<hive.client.commons-codec.version>1.15</hive.client.commons-codec.version>
         
<hive.client.httpcomponents-client.version>4.5.13</hive.client.httpcomponents-client.version>
         
<hive.client.httpcomponents-core.version>4.4.13</hive.client.httpcomponents-core.version>
         <hive.client.jline.version>2.12</hive.client.jline.version>
@@ -525,6 +524,12 @@
                 <groupId>org.apache.thrift</groupId>
                 <artifactId>libfb303</artifactId>
                 <version>${fb303.version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>org.apache.thrift</groupId>
+                        <artifactId>libthrift</artifactId>
+                    </exclusion>
+                </exclusions>
             </dependency>
 
             <dependency>
@@ -533,12 +538,8 @@
                 <version>${thrift.version}</version>
                 <exclusions>
                     <exclusion>
-                        <artifactId>commons-logging</artifactId>
-                        <groupId>commons-logging</groupId>
-                    </exclusion>
-                    <exclusion>
-                        <groupId>javax.annotation</groupId>
-                        <artifactId>javax.annotation-api</artifactId>
+                        <groupId>*</groupId>
+                        <artifactId>*</artifactId>
                     </exclusion>
                 </exclusions>
             </dependency>

Reply via email to