mirror of
https://github.com/google/nomulus
synced 2026-08-15 19:56:08 +00:00
Enable new errorprone checks and fix violations (#3018)
This commit is contained in:
@@ -114,8 +114,8 @@ public class ProxyProtocolHandler extends ByteToMessageDecoder {
|
||||
|
||||
private static String getSourceIP(ChannelHandlerContext ctx) {
|
||||
SocketAddress remoteAddress = ctx.channel().remoteAddress();
|
||||
return (remoteAddress instanceof InetSocketAddress)
|
||||
? ((InetSocketAddress) remoteAddress).getAddress().getHostAddress()
|
||||
return (remoteAddress instanceof InetSocketAddress inetSocketAddress)
|
||||
? inetSocketAddress.getAddress().getHostAddress()
|
||||
: null;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,8 +93,8 @@ public class RelayHandler<I> extends SimpleChannelInboundHandler<I> {
|
||||
// to zero and its buffer will be freed. After the buffer is freed, the message cannot be used
|
||||
// anymore, even if in Java's eye the object still exist, its content is gone. We increment a
|
||||
// count here so that the message can be retried, in case the relay is not successful.
|
||||
if (msg instanceof ReferenceCounted) {
|
||||
((ReferenceCounted) msg).retain();
|
||||
if (msg instanceof ReferenceCounted referenceCounted) {
|
||||
referenceCounted.retain();
|
||||
}
|
||||
ChannelFuture unusedFuture =
|
||||
relayChannel
|
||||
|
||||
@@ -150,8 +150,8 @@ public final class TestUtils {
|
||||
private static void assertHttpMessageEquivalent(HttpMessage msg1, HttpMessage msg2) {
|
||||
assertThat(msg1.protocolVersion()).isEqualTo(msg2.protocolVersion());
|
||||
assertThat(msg1.headers()).isEqualTo(msg2.headers());
|
||||
if (msg1 instanceof FullHttpRequest && msg2 instanceof FullHttpRequest) {
|
||||
assertThat(((FullHttpRequest) msg1).content()).isEqualTo(((FullHttpRequest) msg2).content());
|
||||
if (msg1 instanceof FullHttpRequest req1 && msg2 instanceof FullHttpRequest req2) {
|
||||
assertThat(req1.content()).isEqualTo(req2.content());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -302,8 +302,7 @@ class TokenStoreTest {
|
||||
// Verify that a task is scheduled.
|
||||
ArgumentCaptor<Runnable> argument = ArgumentCaptor.forClass(Runnable.class);
|
||||
verify(refreshExecutor)
|
||||
.scheduleWithFixedDelay(
|
||||
argument.capture(), eq((long) 5), eq((long) 5), eq(TimeUnit.SECONDS));
|
||||
.scheduleWithFixedDelay(argument.capture(), eq(5L), eq(5L), eq(TimeUnit.SECONDS));
|
||||
|
||||
// Verify that the scheduled task calls TokenStore.refresh().
|
||||
argument.getValue().run();
|
||||
|
||||
Reference in New Issue
Block a user