Skip to content

Commit d6bbe32

Browse files
committed
[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 07bf0e2 [Kent Yao] codec 96e41e7 [Kent Yao] codec 1da2643 [Kent Yao] guava 6cf0abb [Kent Yao] base64 & sha1 3b45ec2 [Kent Yao] base64 5490cfa [Kent Yao] http 6f4b48b [Kent Yao] n 2a87a4c [Kent Yao] d a5ad3cc [Kent Yao] Refine Deps in common module 24d5299 [Kent Yao] Refine Deps in common module Authored-by: Kent Yao <yao@apache.org> Signed-off-by: Kent Yao <yao@apache.org>
1 parent 5c0c760 commit d6bbe32

File tree

13 files changed

+47
-56
lines changed

13 files changed

+47
-56
lines changed

dev/dependencyList

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
aopalliance-repackaged/2.6.1//aopalliance-repackaged-2.6.1.jar
1919
classgraph/4.8.95//classgraph-4.8.95.jar
20-
commons-codec/1.15//commons-codec-1.15.jar
2120
commons-lang/2.6//commons-lang-2.6.jar
2221
commons-lang3/3.10//commons-lang3-3.10.jar
2322
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
3635
hk2-locator/2.6.1//hk2-locator-2.6.1.jar
3736
hk2-utils/2.6.1//hk2-utils-2.6.1.jar
3837
htrace-core4/4.1.0-incubating//htrace-core4-4.1.0-incubating.jar
39-
httpclient/4.5.13//httpclient-4.5.13.jar
40-
httpcore/4.4.15//httpcore-4.4.15.jar
4138
jackson-annotations/2.13.1//jackson-annotations-2.13.1.jar
4239
jackson-core/2.13.1//jackson-core-2.13.1.jar
4340
jackson-databind/2.13.1//jackson-databind-2.13.1.jar

kyuubi-common/pom.xml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,19 @@
7777
<groupId>org.apache.hadoop</groupId>
7878
<artifactId>hadoop-client-runtime</artifactId>
7979
<scope>runtime</scope>
80-
</dependency>
81-
82-
<dependency>
83-
<groupId>commons-codec</groupId>
84-
<artifactId>commons-codec</artifactId>
80+
<exclusions>
81+
<exclusion>
82+
<groupId>com.google.code.findbugs</groupId>
83+
<artifactId>jsr305</artifactId>
84+
</exclusion>
85+
</exclusions>
8586
</dependency>
8687

8788
<dependency>
8889
<groupId>org.apache.commons</groupId>
8990
<artifactId>commons-lang3</artifactId>
9091
</dependency>
9192

92-
<dependency>
93-
<groupId>com.google.guava</groupId>
94-
<artifactId>guava</artifactId>
95-
</dependency>
96-
9793
<dependency>
9894
<groupId>org.apache.thrift</groupId>
9995
<artifactId>libfb303</artifactId>
@@ -109,11 +105,6 @@
109105
<artifactId>hive-service-rpc</artifactId>
110106
</dependency>
111107

112-
<dependency>
113-
<groupId>jakarta.xml.bind</groupId>
114-
<artifactId>jakarta.xml.bind-api</artifactId>
115-
</dependency>
116-
117108
<dependency>
118109
<groupId>com.fasterxml.jackson.module</groupId>
119110
<artifactId>jackson-module-scala_${scala.binary.version}</artifactId>

kyuubi-common/src/main/scala/org/apache/kyuubi/service/authentication/HadoopThriftAuthBridgeServer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ package org.apache.kyuubi.service.authentication
2020
import java.io.IOException
2121
import java.net.InetAddress
2222
import java.security.PrivilegedAction
23+
import java.util.Base64
2324
import javax.security.auth.callback._
2425
import javax.security.sasl.{AuthorizeCallback, RealmCallback}
2526

26-
import org.apache.commons.codec.binary.Base64
2727
import org.apache.hadoop.fs.FileSystem
2828
import org.apache.hadoop.security.{SaslRpcServer, UserGroupInformation}
2929
import org.apache.hadoop.security.SaslRpcServer.AuthMethod
@@ -190,7 +190,7 @@ object HadoopThriftAuthBridgeServer {
190190

191191
def getPasswd(identifier: KyuubiDelegationTokenIdentifier): Array[Char] = {
192192
val passwd = secretMgr.retrievePassword(identifier)
193-
new String(Base64.encodeBase64(passwd)).toCharArray
193+
Base64.getMimeEncoder.encodeToString(passwd).toCharArray
194194
}
195195

196196
override def handle(callbacks: Array[Callback]): Unit = {

kyuubi-common/src/main/scala/org/apache/kyuubi/util/KyuubiHadoopUtils.scala

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@
1818
package org.apache.kyuubi.util
1919

2020
import java.io.{ByteArrayInputStream, ByteArrayOutputStream, DataInputStream, DataOutputStream}
21-
import java.util.{Map => JMap}
21+
import java.util.{Base64, Map => JMap}
2222

2323
import scala.collection.JavaConverters._
2424

25-
import org.apache.commons.codec.binary.Base64
2625
import org.apache.hadoop.conf.Configuration
2726
import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier
2827
import org.apache.hadoop.io.Text
@@ -58,13 +57,11 @@ object KyuubiHadoopUtils {
5857
val byteStream = new ByteArrayOutputStream
5958
creds.writeTokenStorageToStream(new DataOutputStream(byteStream))
6059

61-
val encoder = new Base64(0, null, false)
62-
encoder.encodeToString(byteStream.toByteArray)
60+
Base64.getMimeEncoder.encodeToString(byteStream.toByteArray)
6361
}
6462

6563
def decodeCredentials(newValue: String): Credentials = {
66-
val decoder = new Base64(0, null, false)
67-
val decoded = decoder.decode(newValue)
64+
val decoded = Base64.getMimeDecoder.decode(newValue)
6865

6966
val byteStream = new ByteArrayInputStream(decoded)
7067
val creds = new Credentials()

kyuubi-ha/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@
5454
<artifactId>zookeeper</artifactId>
5555
</dependency>
5656

57+
<dependency>
58+
<groupId>com.google.guava</groupId>
59+
<artifactId>guava</artifactId>
60+
</dependency>
61+
5762
<dependency>
5863
<groupId>org.apache.kyuubi</groupId>
5964
<artifactId>kyuubi-common_${scala.binary.version}</artifactId>

kyuubi-hive-jdbc-shaded/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@
151151
<dependency>
152152
<groupId>commons-codec</groupId>
153153
<artifactId>commons-codec</artifactId>
154-
<version>${hive.client.commons-codec.version}</version>
155154
</dependency>
156155

157156
<dependency>

kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import javax.net.ssl.TrustManagerFactory;
3737
import javax.security.sasl.Sasl;
3838
import javax.security.sasl.SaslException;
39-
import org.apache.commons.codec.binary.Base64;
4039
import org.apache.commons.lang.StringUtils;
4140
import org.apache.hadoop.hive.common.auth.HiveAuthUtils;
4241
import org.apache.hive.service.auth.HiveAuthFactory;
@@ -787,8 +786,8 @@ private void openSession() throws SQLException {
787786

788787
if (launchEngineOpHandleGuid != null && launchEngineOpHandleSecret != null) {
789788
try {
790-
byte[] guidBytes = Base64.decodeBase64(launchEngineOpHandleGuid);
791-
byte[] secretBytes = Base64.decodeBase64(launchEngineOpHandleSecret);
789+
byte[] guidBytes = Base64.getMimeDecoder().decode(launchEngineOpHandleGuid);
790+
byte[] secretBytes = Base64.getMimeDecoder().decode(launchEngineOpHandleSecret);
792791
THandleIdentifier handleIdentifier =
793792
new THandleIdentifier(ByteBuffer.wrap(guidBytes), ByteBuffer.wrap(secretBytes));
794793
launchEngineOpHandle =

kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiStatement.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,7 @@
2323
import java.sql.SQLFeatureNotSupportedException;
2424
import java.sql.SQLTimeoutException;
2525
import java.sql.SQLWarning;
26-
import java.util.ArrayList;
27-
import java.util.Collections;
28-
import java.util.HashMap;
29-
import java.util.List;
30-
import java.util.Map;
31-
import org.apache.commons.codec.binary.Base64;
26+
import java.util.*;
3227
import org.apache.hive.service.cli.RowSet;
3328
import org.apache.hive.service.cli.RowSetFactory;
3429
import org.apache.hive.service.rpc.thrift.TCLIService;
@@ -988,7 +983,7 @@ public String getYarnATSGuid() {
988983
// Set on the server side.
989984
// @see org.apache.hive.service.cli.operation.SQLOperation#prepare
990985
String guid64 =
991-
Base64.encodeBase64URLSafeString(stmtHandle.getOperationId().getGuid()).trim();
986+
Base64.getUrlEncoder().encodeToString(stmtHandle.getOperationId().getGuid()).trim();
992987
return guid64;
993988
}
994989
return null;

kyuubi-metrics/src/main/scala/org/apache/kyuubi/metrics/PrometheusReporterService.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package org.apache.kyuubi.metrics
1919

2020
import com.codahale.metrics.MetricRegistry
21-
import com.google.common.annotations.VisibleForTesting
2221
import io.prometheus.client.CollectorRegistry
2322
import io.prometheus.client.dropwizard.DropwizardExports
2423
import io.prometheus.client.exporter.MetricsServlet
@@ -34,7 +33,7 @@ class PrometheusReporterService(registry: MetricRegistry)
3433

3534
private val bridgeRegistry = new CollectorRegistry
3635

37-
@VisibleForTesting
36+
// VisibleForTesting
3837
private[metrics] var httpServer: Server = _
3938
@volatile protected var isStarted = false
4039

kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendService.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
package org.apache.kyuubi.server
1919

20-
import org.apache.commons.codec.binary.Base64
20+
import java.util.Base64
21+
2122
import org.apache.hive.service.rpc.thrift.{TOpenSessionReq, TOpenSessionResp}
2223

2324
import org.apache.kyuubi.KyuubiSQLException
@@ -52,10 +53,10 @@ final class KyuubiTBinaryFrontendService(
5253
val opHandleIdentifier = launchEngineOp.getHandle.identifier.toTHandleIdentifier
5354
respConfiguration.put(
5455
"kyuubi.session.engine.launch.handle.guid",
55-
Base64.encodeBase64String(opHandleIdentifier.getGuid))
56+
Base64.getMimeEncoder.encodeToString(opHandleIdentifier.getGuid))
5657
respConfiguration.put(
5758
"kyuubi.session.engine.launch.handle.secret",
58-
Base64.encodeBase64String(opHandleIdentifier.getSecret))
59+
Base64.getMimeEncoder.encodeToString(opHandleIdentifier.getSecret))
5960

6061
resp.setSessionHandle(sessionHandle.toTSessionHandle)
6162
resp.setConfiguration(respConfiguration)

kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/authentication/MySQLNativePassword.scala

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
package org.apache.kyuubi.server.mysql.authentication
1919

20-
import java.util
21-
22-
import org.apache.commons.codec.digest.DigestUtils
20+
import java.nio.charset.StandardCharsets
21+
import java.security.MessageDigest
22+
import java.util.Arrays
2323

2424
import org.apache.kyuubi.server.mysql.authentication.MySQLAuthentication.randomBytes
2525
import org.apache.kyuubi.server.mysql.authentication.MySQLNativePassword.PluginData
@@ -52,16 +52,17 @@ class MySQLNativePassword {
5252
}
5353

5454
private[authentication] def isPasswordRight(password: String, authentication: Array[Byte]) =
55-
util.Arrays.equals(getAuthCipherBytes(password), authentication)
55+
Arrays.equals(getAuthCipherBytes(password), authentication)
5656

5757
private def getAuthCipherBytes(password: String): Array[Byte] = {
5858
val salt = pluginData.full
59-
val passwordSha1 = DigestUtils.sha1(password)
60-
val passwordSha1Sha1 = DigestUtils.sha1(passwordSha1)
59+
val sha1 = MessageDigest.getInstance("SHA-1")
60+
val passwordSha1 = sha1.digest(password.getBytes(StandardCharsets.UTF_8))
61+
val passwordSha1Sha1 = sha1.digest(passwordSha1)
6162
val secret = new Array[Byte](salt.length + passwordSha1Sha1.length)
6263
System.arraycopy(salt, 0, secret, 0, salt.length)
6364
System.arraycopy(passwordSha1Sha1, 0, secret, salt.length, passwordSha1Sha1.length)
64-
val secretSha1 = DigestUtils.sha1(secret)
65+
val secretSha1 = sha1.digest(secret)
6566
xor(passwordSha1, secretSha1)
6667
}
6768

kyuubi-zookeeper/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@
6868
<artifactId>curator-client</artifactId>
6969
<scope>test</scope>
7070
</dependency>
71+
72+
<dependency>
73+
<groupId>com.google.guava</groupId>
74+
<artifactId>guava</artifactId>
75+
<scope>test</scope>
76+
</dependency>
7177
</dependencies>
7278

7379
<build>

pom.xml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@
151151

152152
<!-- apply to kyuubi-hive-jdbc/kyuubi-hive-beeline module -->
153153
<hive.client.commons-cli.version>1.2</hive.client.commons-cli.version>
154-
<hive.client.commons-codec.version>1.15</hive.client.commons-codec.version>
155154
<hive.client.httpcomponents-client.version>4.5.13</hive.client.httpcomponents-client.version>
156155
<hive.client.httpcomponents-core.version>4.4.13</hive.client.httpcomponents-core.version>
157156
<hive.client.jline.version>2.12</hive.client.jline.version>
@@ -525,6 +524,12 @@
525524
<groupId>org.apache.thrift</groupId>
526525
<artifactId>libfb303</artifactId>
527526
<version>${fb303.version}</version>
527+
<exclusions>
528+
<exclusion>
529+
<groupId>org.apache.thrift</groupId>
530+
<artifactId>libthrift</artifactId>
531+
</exclusion>
532+
</exclusions>
528533
</dependency>
529534

530535
<dependency>
@@ -533,12 +538,8 @@
533538
<version>${thrift.version}</version>
534539
<exclusions>
535540
<exclusion>
536-
<artifactId>commons-logging</artifactId>
537-
<groupId>commons-logging</groupId>
538-
</exclusion>
539-
<exclusion>
540-
<groupId>javax.annotation</groupId>
541-
<artifactId>javax.annotation-api</artifactId>
541+
<groupId>*</groupId>
542+
<artifactId>*</artifactId>
542543
</exclusion>
543544
</exclusions>
544545
</dependency>

0 commit comments

Comments
 (0)