This is an automated email from the ASF dual-hosted git repository.
chengpan pushed a commit to branch branch-1.9
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/branch-1.9 by this push:
new 20d639d31 [KYUUBI #6457] Strip dependencies from REST client
20d639d31 is described below
commit 20d639d313bcbf4eaaa946e01148cc65da5d8468
Author: Cheng Pan <[email protected]>
AuthorDate: Fri Jun 7 17:17:06 2024 +0800
[KYUUBI #6457] Strip dependencies from REST client
# :mag: Description
This PR removes two dependencies from the `kyuubi-rest-client` module
- `commons-collections` - has CVE Cx78f40514-81ff and is only used in one
place, just rewrite to remove the dependency
- `javax.servlet-api` - only used for UT, correct the scope from `compile`
to `test`
## Types of changes :bookmark:
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
## Test Plan ๐งช
Pass GHA
---
# Checklist ๐
- [x] This patch was not authored or co-authored using [Generative
Tooling](https://www.apache.org/legal/generative-tooling.html)
**Be nice. Be informative.**
Closes #6457 from pan3793/rest-client-dep.
Closes #6457
c24af70ac [Cheng Pan] dep list
80969d0d3 [Cheng Pan] nit
950d4b730 [Cheng Pan] fix
169281903 [Cheng Pan] fix import
c068ba10f [Cheng Pan] nit
d46653d53 [Cheng Pan] fix
ca7831732 [Cheng Pan] Strip dependencies from REST client
Authored-by: Cheng Pan <[email protected]>
Signed-off-by: Cheng Pan <[email protected]>
(cherry picked from commit f7e8d69ac0595f2856b9204323dd37925caa472c)
Signed-off-by: Cheng Pan <[email protected]>
---
dev/dependencyList | 1 -
kyuubi-rest-client/pom.xml | 16 ++++++----------
.../main/java/org/apache/kyuubi/client/RestClient.java | 3 +--
3 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/dev/dependencyList b/dev/dependencyList
index 327d4ac15..348bf08b6 100644
--- a/dev/dependencyList
+++ b/dev/dependencyList
@@ -29,7 +29,6 @@ arrow-vector/12.0.0//arrow-vector-12.0.0.jar
checker-qual/3.42.0//checker-qual-3.42.0.jar
classgraph/4.8.138//classgraph-4.8.138.jar
commons-codec/1.15//commons-codec-1.15.jar
-commons-collections/3.2.2//commons-collections-3.2.2.jar
commons-lang3/3.13.0//commons-lang3-3.13.0.jar
commons-logging/1.1.3//commons-logging-1.1.3.jar
error_prone_annotations/2.20.0//error_prone_annotations-2.20.0.jar
diff --git a/kyuubi-rest-client/pom.xml b/kyuubi-rest-client/pom.xml
index 24571ff9a..cf4b226c7 100644
--- a/kyuubi-rest-client/pom.xml
+++ b/kyuubi-rest-client/pom.xml
@@ -39,16 +39,6 @@
<artifactId>jackson-databind</artifactId>
</dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- </dependency>
-
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
@@ -122,6 +112,12 @@
<artifactId>jetty-servlet</artifactId>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git
a/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/RestClient.java
b/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/RestClient.java
index 86af2c759..86de74cf6 100644
--- a/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/RestClient.java
+++ b/kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/RestClient.java
@@ -24,7 +24,6 @@ import java.net.URISyntaxException;
import java.net.UnknownHostException;
import java.nio.charset.StandardCharsets;
import java.util.Map;
-import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
@@ -207,7 +206,7 @@ public class RestClient implements IRestClient {
String url = StringUtils.isNotBlank(path) ? this.baseUrl + "/" + path :
this.baseUrl;
URIBuilder builder = new URIBuilder(url);
- if (MapUtils.isNotEmpty(params)) {
+ if (params != null) {
for (Map.Entry<String, Object> entry : params.entrySet()) {
if (entry.getValue() != null) {
builder.addParameter(entry.getKey(), entry.getValue().toString());