diff --git a/shield/src/main/java/org/elasticsearch/shield/transport/ShieldServerTransportService.java b/shield/src/main/java/org/elasticsearch/shield/transport/ShieldServerTransportService.java index 6db76fb3890..0277d660e4c 100644 --- a/shield/src/main/java/org/elasticsearch/shield/transport/ShieldServerTransportService.java +++ b/shield/src/main/java/org/elasticsearch/shield/transport/ShieldServerTransportService.java @@ -5,7 +5,6 @@ */ package org.elasticsearch.shield.transport; -import com.google.common.collect.Maps; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; @@ -19,6 +18,7 @@ import org.elasticsearch.transport.*; import org.elasticsearch.transport.netty.NettyTransport; import java.util.Collections; +import java.util.HashMap; import java.util.Map; import java.util.concurrent.Callable; @@ -80,7 +80,7 @@ public class ShieldServerTransportService extends TransportService { } Map profileSettingsMap = settings.getGroups("transport.profiles.", true); - Map profileFilters = Maps.newHashMapWithExpectedSize(profileSettingsMap.size() + 1); + Map profileFilters = new HashMap<>(profileSettingsMap.size() + 1); for (Map.Entry entry : profileSettingsMap.entrySet()) { Settings profileSettings = entry.getValue(); diff --git a/shield/src/main/java/org/elasticsearch/shield/transport/filter/IPFilter.java b/shield/src/main/java/org/elasticsearch/shield/transport/filter/IPFilter.java index 576b811ba52..772af248cb8 100644 --- a/shield/src/main/java/org/elasticsearch/shield/transport/filter/IPFilter.java +++ b/shield/src/main/java/org/elasticsearch/shield/transport/filter/IPFilter.java @@ -7,7 +7,6 @@ package org.elasticsearch.shield.transport.filter; import com.carrotsearch.hppc.ObjectObjectHashMap; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; import com.google.common.collect.ObjectArrays; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.collect.HppcMaps; @@ -24,7 +23,6 @@ import org.elasticsearch.shield.audit.AuditTrail; import org.elasticsearch.transport.Transport; import java.net.InetAddress; -import java.net.UnknownHostException; import java.util.*; public class IPFilter extends AbstractLifecycleComponent { @@ -143,7 +141,7 @@ public class IPFilter extends AbstractLifecycleComponent { return Collections.EMPTY_MAP; } - Map profileRules = Maps.newHashMap(); + Map profileRules = new HashMap<>(); if (isHttpFilterEnabled && httpServerTransport != null && httpServerTransport.lifecycleState() == Lifecycle.State.STARTED) { InetAddress localAddress = ((InetSocketTransportAddress) this.httpServerTransport.boundAddress().boundAddress()).address().getAddress(); diff --git a/shield/src/test/java/org/elasticsearch/integration/AbstractPrivilegeTestCase.java b/shield/src/test/java/org/elasticsearch/integration/AbstractPrivilegeTestCase.java index b01c6db8ab8..f3fbd445d56 100644 --- a/shield/src/test/java/org/elasticsearch/integration/AbstractPrivilegeTestCase.java +++ b/shield/src/test/java/org/elasticsearch/integration/AbstractPrivilegeTestCase.java @@ -5,8 +5,6 @@ */ package org.elasticsearch.integration; -import com.google.common.collect.Maps; - import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.elasticsearch.http.HttpServerTransport; @@ -19,6 +17,7 @@ import org.elasticsearch.test.rest.client.http.HttpResponse; import org.junit.After; import java.io.IOException; +import java.util.HashMap; import java.util.Locale; import java.util.Map; @@ -45,19 +44,19 @@ public abstract class AbstractPrivilegeTestCase extends ShieldIntegTestCase { } protected void assertAccessIsAllowed(String user, String method, String uri, String body) throws IOException { - assertAccessIsAllowed(user, method, uri, body, Maps.newHashMap()); + assertAccessIsAllowed(user, method, uri, body, new HashMap<>()); } protected void assertAccessIsAllowed(String user, String method, String uri) throws IOException { - assertAccessIsAllowed(user, method, uri, null, Maps.newHashMap()); + assertAccessIsAllowed(user, method, uri, null, new HashMap<>()); } protected void assertAccessIsDenied(String user, String method, String uri, String body) throws IOException { - assertAccessIsDenied(user, method, uri, body, Maps.newHashMap()); + assertAccessIsDenied(user, method, uri, body, new HashMap<>()); } protected void assertAccessIsDenied(String user, String method, String uri) throws IOException { - assertAccessIsDenied(user, method, uri, null, Maps.newHashMap()); + assertAccessIsDenied(user, method, uri, null, new HashMap<>()); } protected void assertAccessIsDenied(String user, String method, String uri, String body, Map params) throws IOException { diff --git a/shield/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java b/shield/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java index 5e079be4966..be0e63840b8 100644 --- a/shield/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java +++ b/shield/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java @@ -5,7 +5,6 @@ */ package org.elasticsearch.integration; -import com.google.common.collect.Maps; import com.google.common.collect.ImmutableMap; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.Node; @@ -13,6 +12,7 @@ import org.elasticsearch.test.rest.client.http.HttpResponse; import org.junit.Before; import org.junit.Test; +import java.util.HashMap; import java.util.Locale; import static org.hamcrest.Matchers.is; @@ -320,7 +320,7 @@ public class IndexPrivilegeTests extends AbstractPrivilegeTestCase { @Test public void testThatUnknownUserIsRejectedProperly() throws Exception { - HttpResponse response = executeRequest("idonotexist", "GET", "/", null, Maps.newHashMap()); + HttpResponse response = executeRequest("idonotexist", "GET", "/", null, new HashMap<>()); assertThat(response.getStatusCode(), is(401)); }