From 98445a41d39505bbe4f503149211ff45904ccf06 Mon Sep 17 00:00:00 2001 From: Patrick Hobusch Date: Thu, 19 Feb 2026 10:23:09 +0800 Subject: [PATCH] fix(crowd): Remove implicit usages of the Guava ImmutableSet class --- .../crowd/service/TrustedProxiesServiceImpl.java | 4 ++-- .../crowd/service/TrustedProxiesServiceTest.java | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/crowd/src/main/java/com/deftdevs/bootstrapi/crowd/service/TrustedProxiesServiceImpl.java b/crowd/src/main/java/com/deftdevs/bootstrapi/crowd/service/TrustedProxiesServiceImpl.java index 7782c6b6..41e603ee 100644 --- a/crowd/src/main/java/com/deftdevs/bootstrapi/crowd/service/TrustedProxiesServiceImpl.java +++ b/crowd/src/main/java/com/deftdevs/bootstrapi/crowd/service/TrustedProxiesServiceImpl.java @@ -3,9 +3,9 @@ import com.atlassian.crowd.manager.property.PropertyManager; import com.atlassian.crowd.manager.property.PropertyManagerException; import com.deftdevs.bootstrapi.crowd.service.api.TrustedProxiesService; -import com.google.common.collect.ImmutableSet; import org.apache.commons.lang3.StringUtils; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashSet; @@ -66,7 +66,7 @@ private Set getTrustedProxiesInternal() { final String trustedProxyServers = this.propertyManager.getTrustedProxyServers(); if (!StringUtils.isBlank(trustedProxyServers)) { final String[] trustedProxyServerStrings = StringUtils.split(trustedProxyServers, SEPARATOR); - return ImmutableSet.copyOf(trustedProxyServerStrings); + return Set.copyOf(Arrays.asList(trustedProxyServerStrings)); } } catch (PropertyManagerException ignored) {} diff --git a/crowd/src/test/java/com/deftdevs/bootstrapi/crowd/service/TrustedProxiesServiceTest.java b/crowd/src/test/java/com/deftdevs/bootstrapi/crowd/service/TrustedProxiesServiceTest.java index c44564b1..692fd772 100644 --- a/crowd/src/test/java/com/deftdevs/bootstrapi/crowd/service/TrustedProxiesServiceTest.java +++ b/crowd/src/test/java/com/deftdevs/bootstrapi/crowd/service/TrustedProxiesServiceTest.java @@ -2,7 +2,6 @@ import com.atlassian.crowd.manager.property.PropertyManager; import com.atlassian.crowd.manager.property.PropertyManagerException; -import com.google.common.collect.ImmutableSet; import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -14,9 +13,12 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; +import java.util.Set; import static com.deftdevs.bootstrapi.crowd.service.TrustedProxiesServiceImpl.SEPARATOR; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.lenient; @@ -41,7 +43,7 @@ public void setup() throws PropertyManagerException { lenient().doAnswer(invocation -> { final String[] trustedProxiesStrings = StringUtils.split((String) invocation.getArguments()[0], SEPARATOR); trustedProxies.clear(); - trustedProxies.addAll(ImmutableSet.copyOf(trustedProxiesStrings)); + trustedProxies.addAll(Set.copyOf(Arrays.asList(trustedProxiesStrings))); return null; // return null since the method is void }).when(propertyManager).setTrustedProxyServers(anyString());