From 348ad7a42e91c3e12609b65bd7f0a2bef88d0401 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Thu, 14 Apr 2016 07:47:13 -0400 Subject: [PATCH] Label method as @SafeVarargs --- .../java/org/elasticsearch/http/netty/NettyHttpClient.java | 6 +++--- .../http/netty/NettyHttpRequestSizeLimitIT.java | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/core/src/test/java/org/elasticsearch/http/netty/NettyHttpClient.java b/core/src/test/java/org/elasticsearch/http/netty/NettyHttpClient.java index ce6ffc2b264..6af06f605dc 100644 --- a/core/src/test/java/org/elasticsearch/http/netty/NettyHttpClient.java +++ b/core/src/test/java/org/elasticsearch/http/netty/NettyHttpClient.java @@ -28,7 +28,6 @@ import org.jboss.netty.channel.ChannelFuture; import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.channel.ChannelPipeline; import org.jboss.netty.channel.ChannelPipelineFactory; -import org.jboss.netty.channel.ChannelStateEvent; import org.jboss.netty.channel.Channels; import org.jboss.netty.channel.ExceptionEvent; import org.jboss.netty.channel.MessageEvent; @@ -55,7 +54,7 @@ import static org.jboss.netty.handler.codec.http.HttpHeaders.Names.HOST; import static org.jboss.netty.handler.codec.http.HttpVersion.HTTP_1_1; /** - * Tiny helper + * Tiny helper to send http requests over netty. */ public class NettyHttpClient implements Closeable { @@ -92,7 +91,8 @@ public class NettyHttpClient implements Closeable { return sendRequests(remoteAddress, requests); } - public Collection post(SocketAddress remoteAddress, Tuple... urisAndBodies) + @SafeVarargs // Safe not because it doesn't do anything with the type parameters but because it won't leak them into other methods. + public final Collection post(SocketAddress remoteAddress, Tuple... urisAndBodies) throws InterruptedException { Collection requests = new ArrayList<>(urisAndBodies.length); for (Tuple uriAndBody : urisAndBodies) { diff --git a/core/src/test/java/org/elasticsearch/http/netty/NettyHttpRequestSizeLimitIT.java b/core/src/test/java/org/elasticsearch/http/netty/NettyHttpRequestSizeLimitIT.java index 1640e482a2c..bf65ec4ff8b 100644 --- a/core/src/test/java/org/elasticsearch/http/netty/NettyHttpRequestSizeLimitIT.java +++ b/core/src/test/java/org/elasticsearch/http/netty/NettyHttpRequestSizeLimitIT.java @@ -80,7 +80,6 @@ public class NettyHttpRequestSizeLimitIT extends ESIntegTestCase { ().boundAddresses()); try (NettyHttpClient nettyHttpClient = new NettyHttpClient()) { - @SuppressWarnings("unchecked") Collection singleResponse = nettyHttpClient.post(inetSocketTransportAddress.address(), requests[0]); assertThat(singleResponse, hasSize(1)); assertAtLeastOnceExpectedStatus(singleResponse, HttpResponseStatus.OK);