You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by du...@apache.org on 2022/02/07 16:00:35 UTC
[sling-org-apache-sling-testing-clients] branch master updated: SLING-11124 - Remove Guava Dependency for CVE CVE-2018-10237 and CVE-2020-8908 (#27)
This is an automated email from the ASF dual-hosted git repository.
dulvac pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-clients.git
The following commit(s) were added to refs/heads/master by this push:
new c100617 SLING-11124 - Remove Guava Dependency for CVE CVE-2018-10237 and CVE-2020-8908 (#27)
c100617 is described below
commit c10061729ae8f09c29e807c046289b8993c229d6
Author: Andrei Tuicu <an...@gmail.com>
AuthorDate: Mon Feb 7 17:00:29 2022 +0100
SLING-11124 - Remove Guava Dependency for CVE CVE-2018-10237 and CVE-2020-8908 (#27)
* SLING-11124 - Remove Guava Dependency for CVE CVE-2018-10237 and CVE-2020-8908
Co-authored-by: Andrei Tuicu <tu...@adobe.com>
---
pom.xml | 5 -----
.../org/apache/sling/testing/clients/SlingClientConfig.java | 6 +++---
.../org/apache/sling/testing/clients/osgi/ServiceInfoTest.java | 10 ++++++----
3 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/pom.xml b/pom.xml
index 82061ee..3f125ca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -124,11 +124,6 @@
<version>1.14.3</version>
</dependency>
<dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>31.0.1-jre</version>
- </dependency>
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.32</version>
diff --git a/src/main/java/org/apache/sling/testing/clients/SlingClientConfig.java b/src/main/java/org/apache/sling/testing/clients/SlingClientConfig.java
index 825dfe8..843c226 100644
--- a/src/main/java/org/apache/sling/testing/clients/SlingClientConfig.java
+++ b/src/main/java/org/apache/sling/testing/clients/SlingClientConfig.java
@@ -16,7 +16,6 @@
*/
package org.apache.sling.testing.clients;
-import com.google.common.base.Strings;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost;
import org.apache.http.annotation.ThreadSafe;
@@ -34,6 +33,7 @@ import org.apache.http.impl.client.BasicCredentialsProvider;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Map;
+import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
@ThreadSafe
@@ -171,8 +171,8 @@ public class SlingClientConfig {
public Builder setUrl(URI url) {
this.url = url;
// Add / as path if none is present
- if (Strings.isNullOrEmpty(this.url.getPath()) || !this.url.getPath().endsWith("/")) {
- this.url = this.url.resolve(Strings.nullToEmpty(this.url.getPath()) + "/");
+ if (StringUtils.isEmpty(this.url.getPath()) || !this.url.getPath().endsWith("/")) {
+ this.url = this.url.resolve(Optional.ofNullable(this.url.getPath()).orElse("") + "/");
}
return this;
}
diff --git a/src/test/java/org/apache/sling/testing/clients/osgi/ServiceInfoTest.java b/src/test/java/org/apache/sling/testing/clients/osgi/ServiceInfoTest.java
index 3ca90d6..05fed8c 100644
--- a/src/test/java/org/apache/sling/testing/clients/osgi/ServiceInfoTest.java
+++ b/src/test/java/org/apache/sling/testing/clients/osgi/ServiceInfoTest.java
@@ -16,13 +16,12 @@
*/
package org.apache.sling.testing.clients.osgi;
-import com.google.common.io.Resources;
import org.apache.sling.testing.clients.ClientException;
import org.apache.sling.testing.clients.util.JsonUtils;
+import org.apache.sling.testing.clients.util.ResourceUtil;
import org.junit.Test;
import java.io.IOException;
-import java.nio.charset.StandardCharsets;
import java.util.Collections;
import static org.junit.Assert.assertEquals;
@@ -40,8 +39,11 @@ public class ServiceInfoTest {
}
private void assertServiceInfo(final String file) throws IOException, ClientException {
- final ServiceInfo serviceInfo = new ServiceInfo(JsonUtils.getJsonNodeFromString(
- Resources.toString(Resources.getResource("service-info/" + file + ".json"), StandardCharsets.UTF_8)));
+ final ServiceInfo serviceInfo = new ServiceInfo(
+ JsonUtils.getJsonNodeFromString(
+ ResourceUtil.readResourceAsString("service-info/" + file + ".json")
+ )
+ );
assertEquals(10, serviceInfo.getId());
assertEquals("org.example.MyService", serviceInfo.getPid());
assertEquals(6, serviceInfo.getBundleId());