From 840ad265625303bae99f8caf713bb057cc97da89 Mon Sep 17 00:00:00 2001 From: svc-excavator-bot Date: Mon, 16 Dec 2019 18:06:07 +0000 Subject: [PATCH] Excavator: Upgrades Baseline to the latest version --- .baseline/checkstyle/checkstyle.xml | 22 +++++++++---------- build.gradle | 2 +- .../dialogue/AbstractChannelTest.java | 4 ++-- .../dialogue/core/BlacklistingChannel.java | 4 ++-- .../core/ConcurrencyLimitedChannel.java | 2 +- .../dialogue/core/InstrumentedChannel.java | 4 ++-- .../core/RefreshingChannelFactory.java | 2 +- .../palantir/dialogue/core/ChannelsTest.java | 2 +- .../core/ConcurrencyLimitedChannelTest.java | 4 ++-- .../dialogue/core/RetryingChannelTest.java | 2 +- .../dialogue/core/UserAgentChannelTest.java | 2 +- .../com/palantir/dialogue/HttpChannel.java | 3 ++- .../com/palantir/dialogue/OkHttpChannel.java | 4 ++-- .../java/dialogue/serde/ConjureBodySerDe.java | 6 ++--- .../java/dialogue/serde/Encodings.java | 2 +- .../dialogue/serde/ConjureBodySerDeTest.java | 4 ++-- .../com/palantir/dialogue/UrlBuilder.java | 3 ++- 17 files changed, 37 insertions(+), 35 deletions(-) diff --git a/.baseline/checkstyle/checkstyle.xml b/.baseline/checkstyle/checkstyle.xml index 792229cfc5..cd19cae458 100644 --- a/.baseline/checkstyle/checkstyle.xml +++ b/.baseline/checkstyle/checkstyle.xml @@ -53,6 +53,9 @@ + + + @@ -84,11 +87,13 @@ + org.apache.commons.lang3.Validate.*, + org.assertj.core.api.Assertions.*, + org.mockito.Mockito.*"/> @@ -110,7 +115,6 @@ - @@ -369,10 +373,6 @@ - - - - @@ -422,6 +422,7 @@ + @@ -435,7 +436,7 @@ - + @@ -468,10 +469,9 @@ - + - diff --git a/build.gradle b/build.gradle index 67d03847ce..3af92a7d5f 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ buildscript { classpath 'com.netflix.nebula:gradle-info-plugin:5.2.0' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' classpath 'com.netflix.nebula:nebula-publishing-plugin:14.1.1' - classpath 'com.palantir.baseline:gradle-baseline-java:0.59.0' + classpath 'com.palantir.baseline:gradle-baseline-java:2.43.0' classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.12.2' classpath 'gradle.plugin.org.inferred:gradle-processors:3.1.0' } diff --git a/dialogue-client-test-lib/src/main/java/com/palantir/dialogue/AbstractChannelTest.java b/dialogue-client-test-lib/src/main/java/com/palantir/dialogue/AbstractChannelTest.java index 6858a00f36..7d44cef499 100644 --- a/dialogue-client-test-lib/src/main/java/com/palantir/dialogue/AbstractChannelTest.java +++ b/dialogue-client-test-lib/src/main/java/com/palantir/dialogue/AbstractChannelTest.java @@ -181,7 +181,7 @@ public void fillsQueryParameters() throws Exception { HttpUrl requestUrl = server.takeRequest().getRequestUrl(); Set queryParameters = requestUrl.queryParameterNames(); - assertThat(queryParameters.size()).isEqualTo(2); + assertThat(queryParameters).hasSize(2); assertThat(requestUrl.queryParameterValues("a")).containsExactlyInAnyOrder("A1", "A2"); assertThat(requestUrl.queryParameterValues("b")).containsExactlyInAnyOrder("B"); } @@ -333,7 +333,7 @@ private static Buffer zip(String content) throws IOException { return gzipBytes; } - private static class FakeEndpoint implements Endpoint { + private static final class FakeEndpoint implements Endpoint { private BiConsumer, UrlBuilder> renderPath; private HttpMethod method; diff --git a/dialogue-core/src/main/java/com/palantir/dialogue/core/BlacklistingChannel.java b/dialogue-core/src/main/java/com/palantir/dialogue/core/BlacklistingChannel.java index b7673dfff0..a0d0f72f34 100644 --- a/dialogue-core/src/main/java/com/palantir/dialogue/core/BlacklistingChannel.java +++ b/dialogue-core/src/main/java/com/palantir/dialogue/core/BlacklistingChannel.java @@ -64,7 +64,7 @@ public Optional> maybeExecute(Endpoint endpoint, Requ } } - private class BlacklistingCallback implements FutureCallback { + private final class BlacklistingCallback implements FutureCallback { @Override public void onSuccess(Response response) { // TODO(jellis): use the Retry-After header (if present) to determine how long to blacklist the channel @@ -74,7 +74,7 @@ public void onSuccess(Response response) { } @Override - public void onFailure(Throwable throwable) { + public void onFailure(Throwable _throwable) { isBlacklisted.put(KEY, VALUE); } } diff --git a/dialogue-core/src/main/java/com/palantir/dialogue/core/ConcurrencyLimitedChannel.java b/dialogue-core/src/main/java/com/palantir/dialogue/core/ConcurrencyLimitedChannel.java index dd76a21d4a..c1e9644969 100644 --- a/dialogue-core/src/main/java/com/palantir/dialogue/core/ConcurrencyLimitedChannel.java +++ b/dialogue-core/src/main/java/com/palantir/dialogue/core/ConcurrencyLimitedChannel.java @@ -101,7 +101,7 @@ public void onSuccess(Response result) { } @Override - public void onFailure(Throwable throwable) { + public void onFailure(Throwable _throwable) { listener.onIgnore(); } } diff --git a/dialogue-core/src/main/java/com/palantir/dialogue/core/InstrumentedChannel.java b/dialogue-core/src/main/java/com/palantir/dialogue/core/InstrumentedChannel.java index a49936ec46..ce936bbcee 100644 --- a/dialogue-core/src/main/java/com/palantir/dialogue/core/InstrumentedChannel.java +++ b/dialogue-core/src/main/java/com/palantir/dialogue/core/InstrumentedChannel.java @@ -53,12 +53,12 @@ public ListenableFuture execute(Endpoint endpoint, Request request) { ListenableFuture response = delegate.execute(endpoint, request); Futures.addCallback(response, new FutureCallback<>() { @Override - public void onSuccess(@Nullable Response result) { + public void onSuccess(@Nullable Response _result) { record(endpoint); } @Override - public void onFailure(Throwable throwable) { + public void onFailure(Throwable _throwable) { record(endpoint); } diff --git a/dialogue-core/src/main/java/com/palantir/dialogue/core/RefreshingChannelFactory.java b/dialogue-core/src/main/java/com/palantir/dialogue/core/RefreshingChannelFactory.java index eef86c6422..1f48c2c2c3 100644 --- a/dialogue-core/src/main/java/com/palantir/dialogue/core/RefreshingChannelFactory.java +++ b/dialogue-core/src/main/java/com/palantir/dialogue/core/RefreshingChannelFactory.java @@ -67,7 +67,7 @@ private AlwaysThrowingChannel(String serviceName) { } @Override - public ListenableFuture execute(Endpoint endpoint, Request request) { + public ListenableFuture execute(Endpoint _endpoint, Request _request) { return Futures.immediateFailedFuture( new SafeIllegalStateException("Service not configured", SafeArg.of("serviceName", serviceName))); } diff --git a/dialogue-core/src/test/java/com/palantir/dialogue/core/ChannelsTest.java b/dialogue-core/src/test/java/com/palantir/dialogue/core/ChannelsTest.java index 888a81c3ff..01ed27a0c3 100644 --- a/dialogue-core/src/test/java/com/palantir/dialogue/core/ChannelsTest.java +++ b/dialogue-core/src/test/java/com/palantir/dialogue/core/ChannelsTest.java @@ -46,7 +46,7 @@ public final class ChannelsTest { @Mock private Channel delegate; private Endpoint endpoint = new Endpoint() { @Override - public void renderPath(Map params, UrlBuilder url) {} + public void renderPath(Map _params, UrlBuilder _url) {} @Override public HttpMethod httpMethod() { diff --git a/dialogue-core/src/test/java/com/palantir/dialogue/core/ConcurrencyLimitedChannelTest.java b/dialogue-core/src/test/java/com/palantir/dialogue/core/ConcurrencyLimitedChannelTest.java index 2d63fc792a..6222efd360 100644 --- a/dialogue-core/src/test/java/com/palantir/dialogue/core/ConcurrencyLimitedChannelTest.java +++ b/dialogue-core/src/test/java/com/palantir/dialogue/core/ConcurrencyLimitedChannelTest.java @@ -18,7 +18,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; import com.google.common.util.concurrent.SettableFuture; @@ -86,7 +86,7 @@ public void testUnavailable() { mockLimitUnavailable(); assertThat(channel.maybeExecute(endpoint, request)).isEmpty(); - verifyZeroInteractions(listener); + verifyNoMoreInteractions(listener); } @Test diff --git a/dialogue-core/src/test/java/com/palantir/dialogue/core/RetryingChannelTest.java b/dialogue-core/src/test/java/com/palantir/dialogue/core/RetryingChannelTest.java index 1cb3ec9533..73d4b2870f 100644 --- a/dialogue-core/src/test/java/com/palantir/dialogue/core/RetryingChannelTest.java +++ b/dialogue-core/src/test/java/com/palantir/dialogue/core/RetryingChannelTest.java @@ -109,7 +109,7 @@ public Map> headers() { private static final class TestEndpoint implements Endpoint { @Override - public void renderPath(Map params, UrlBuilder url) {} + public void renderPath(Map _params, UrlBuilder _url) {} @Override public HttpMethod httpMethod() { diff --git a/dialogue-core/src/test/java/com/palantir/dialogue/core/UserAgentChannelTest.java b/dialogue-core/src/test/java/com/palantir/dialogue/core/UserAgentChannelTest.java index 19a0aee507..f399fb9b71 100644 --- a/dialogue-core/src/test/java/com/palantir/dialogue/core/UserAgentChannelTest.java +++ b/dialogue-core/src/test/java/com/palantir/dialogue/core/UserAgentChannelTest.java @@ -38,7 +38,7 @@ public final class UserAgentChannelTest { private static final UserAgent baseAgent = UserAgent.of(UserAgent.Agent.of("test-class", "1.2.3")); private static final Endpoint endpoint = new Endpoint() { @Override - public void renderPath(Map params, UrlBuilder url) {} + public void renderPath(Map _params, UrlBuilder _url) {} @Override public HttpMethod httpMethod() { diff --git a/dialogue-java-client/src/main/java/com/palantir/dialogue/HttpChannel.java b/dialogue-java-client/src/main/java/com/palantir/dialogue/HttpChannel.java index e23eb41084..66891d5ae6 100644 --- a/dialogue-java-client/src/main/java/com/palantir/dialogue/HttpChannel.java +++ b/dialogue-java-client/src/main/java/com/palantir/dialogue/HttpChannel.java @@ -21,6 +21,7 @@ import com.google.common.util.concurrent.ListenableFuture; import com.palantir.logsafe.Preconditions; import com.palantir.logsafe.UnsafeArg; +import com.palantir.logsafe.exceptions.SafeRuntimeException; import java.io.IOException; import java.io.InputStream; import java.net.URISyntaxException; @@ -117,7 +118,7 @@ private static HttpRequest.Builder newRequestBuilder(UrlBuilder url) { try { return HttpRequest.newBuilder().uri(url.build().toURI()); } catch (URISyntaxException e) { - throw new RuntimeException("Failed to construct URI, this is a bug", e); + throw new SafeRuntimeException("Failed to construct URI, this is a bug", e); } } diff --git a/dialogue-okhttp-client/src/main/java/com/palantir/dialogue/OkHttpChannel.java b/dialogue-okhttp-client/src/main/java/com/palantir/dialogue/OkHttpChannel.java index 64843f5e8f..8271b1f50c 100644 --- a/dialogue-okhttp-client/src/main/java/com/palantir/dialogue/OkHttpChannel.java +++ b/dialogue-okhttp-client/src/main/java/com/palantir/dialogue/OkHttpChannel.java @@ -121,12 +121,12 @@ public ListenableFuture execute(Endpoint endpoint, Request request) { SettableFuture future = SettableFuture.create(); okCall.enqueue(new Callback() { @Override - public void onFailure(okhttp3.Call call, IOException exception) { + public void onFailure(okhttp3.Call _call, IOException exception) { future.setException(exception); } @Override - public void onResponse(okhttp3.Call call, okhttp3.Response response) { + public void onResponse(okhttp3.Call _call, okhttp3.Response response) { future.set(OkHttpResponse.wrap(response)); } }); diff --git a/dialogue-serde/src/main/java/com/palantir/conjure/java/dialogue/serde/ConjureBodySerDe.java b/dialogue-serde/src/main/java/com/palantir/conjure/java/dialogue/serde/ConjureBodySerDe.java index 7fc4b69bb2..5e117ad9d9 100644 --- a/dialogue-serde/src/main/java/com/palantir/conjure/java/dialogue/serde/ConjureBodySerDe.java +++ b/dialogue-serde/src/main/java/com/palantir/conjure/java/dialogue/serde/ConjureBodySerDe.java @@ -81,10 +81,10 @@ public Deserializer emptyBodyDeserializer() { return response -> { try { if (response.body().read() != -1) { - throw new RuntimeException("Expected empty response body"); + throw new SafeRuntimeException("Expected empty response body"); } } catch (IOException e) { - throw new RuntimeException("Failed to read from response body", e); + throw new SafeRuntimeException("Failed to read from response body", e); } return null; }; @@ -142,7 +142,7 @@ public RequestBody serialize(T value) { bytes.flush(); bytes.close(); } catch (IOException e) { - throw new RuntimeException("Failed to close or flush ByteStream. This is a bug.", e); + throw new SafeRuntimeException("Failed to close or flush ByteStream. This is a bug.", e); } return new RequestBody() { diff --git a/dialogue-serde/src/main/java/com/palantir/conjure/java/dialogue/serde/Encodings.java b/dialogue-serde/src/main/java/com/palantir/conjure/java/dialogue/serde/Encodings.java index a483a043b7..19a2dbc747 100644 --- a/dialogue-serde/src/main/java/com/palantir/conjure/java/dialogue/serde/Encodings.java +++ b/dialogue-serde/src/main/java/com/palantir/conjure/java/dialogue/serde/Encodings.java @@ -53,7 +53,7 @@ public Serializer serializer(TypeMarker type) { try { writer.writeValue(output, value); } catch (IOException e) { - throw new RuntimeException("Failed to serialize payload, this is a bug", e); + throw new SafeRuntimeException("Failed to serialize payload, this is a bug", e); } }; } diff --git a/dialogue-serde/src/test/java/com/palantir/conjure/java/dialogue/serde/ConjureBodySerDeTest.java b/dialogue-serde/src/test/java/com/palantir/conjure/java/dialogue/serde/ConjureBodySerDeTest.java index 15cc24d691..5115896684 100644 --- a/dialogue-serde/src/test/java/com/palantir/conjure/java/dialogue/serde/ConjureBodySerDeTest.java +++ b/dialogue-serde/src/test/java/com/palantir/conjure/java/dialogue/serde/ConjureBodySerDeTest.java @@ -142,7 +142,7 @@ public static final class StubEncoding implements Encoding { } @Override - public Serializer serializer(TypeMarker type) { + public Serializer serializer(TypeMarker _type) { return (value, output) -> { // nop }; @@ -173,7 +173,7 @@ public String toString() { } } - private static class TestResponse implements Response { + private static final class TestResponse implements Response { private InputStream body = new ByteArrayInputStream(new byte[] {}); private int code = 0; diff --git a/dialogue-target/src/main/java/com/palantir/dialogue/UrlBuilder.java b/dialogue-target/src/main/java/com/palantir/dialogue/UrlBuilder.java index 217e96e6ed..5522b77ea4 100644 --- a/dialogue-target/src/main/java/com/palantir/dialogue/UrlBuilder.java +++ b/dialogue-target/src/main/java/com/palantir/dialogue/UrlBuilder.java @@ -25,6 +25,7 @@ import com.palantir.logsafe.Preconditions; import com.palantir.logsafe.SafeArg; import com.palantir.logsafe.UnsafeArg; +import com.palantir.logsafe.exceptions.SafeIllegalArgumentException; import java.io.ByteArrayOutputStream; import java.net.MalformedURLException; import java.net.URL; @@ -131,7 +132,7 @@ public URL build() { return new URL(protocol, host, port, file.toString()); } catch (MalformedURLException e) { - throw new IllegalArgumentException("Malformed URL", e); + throw new SafeIllegalArgumentException("Malformed URL", e); } }