diff --git a/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Exception.java b/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Exception.java index a622f52c5f..99c0767e63 100644 --- a/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Exception.java +++ b/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Exception.java @@ -225,7 +225,7 @@ public class Http2Exception extends Exception { /** * Close the channel immediately after a {@code GOAWAY} is sent. */ - HARD_SHUTDOWN; + HARD_SHUTDOWN } /** diff --git a/codec-smtp/src/main/java/io/netty/handler/codec/smtp/SmtpRequests.java b/codec-smtp/src/main/java/io/netty/handler/codec/smtp/SmtpRequests.java index 2c42c5d69e..446c6fb9dd 100644 --- a/codec-smtp/src/main/java/io/netty/handler/codec/smtp/SmtpRequests.java +++ b/codec-smtp/src/main/java/io/netty/handler/codec/smtp/SmtpRequests.java @@ -20,6 +20,7 @@ import io.netty.util.internal.ObjectUtil; import io.netty.util.internal.UnstableApi; import java.util.ArrayList; +import java.util.Collections; import java.util.List; /** @@ -94,9 +95,7 @@ public final class SmtpRequests { } else { List params = new ArrayList(mailParameters.length + 1); params.add(sender != null? "FROM:<" + sender + '>' : FROM_NULL_SENDER); - for (CharSequence param : mailParameters) { - params.add(param); - } + Collections.addAll(params, mailParameters); return new DefaultSmtpRequest(SmtpCommand.MAIL, params); } } @@ -111,9 +110,7 @@ public final class SmtpRequests { } else { List params = new ArrayList(rcptParameters.length + 1); params.add("TO:<" + recipient + '>'); - for (CharSequence param : rcptParameters) { - params.add(param); - } + Collections.addAll(params, rcptParameters); return new DefaultSmtpRequest(SmtpCommand.RCPT, params); } } diff --git a/codec/src/main/java/io/netty/handler/codec/ReplayingDecoderByteBuf.java b/codec/src/main/java/io/netty/handler/codec/ReplayingDecoderByteBuf.java index 5e71b7dac6..10baf2b2eb 100644 --- a/codec/src/main/java/io/netty/handler/codec/ReplayingDecoderByteBuf.java +++ b/codec/src/main/java/io/netty/handler/codec/ReplayingDecoderByteBuf.java @@ -15,14 +15,6 @@ */ package io.netty.handler.codec; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; -import io.netty.buffer.SwappedByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.util.ByteProcessor; -import io.netty.util.Signal; -import io.netty.util.internal.StringUtil; - import java.io.InputStream; import java.io.OutputStream; import java.nio.ByteBuffer; @@ -32,6 +24,14 @@ import java.nio.channels.GatheringByteChannel; import java.nio.channels.ScatteringByteChannel; import java.nio.charset.Charset; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufAllocator; +import io.netty.buffer.SwappedByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.util.ByteProcessor; +import io.netty.util.Signal; +import io.netty.util.internal.StringUtil; + /** * Special {@link ByteBuf} implementation which is used by the {@link ReplayingDecoder} */ @@ -488,12 +488,12 @@ final class ReplayingDecoderByteBuf extends ByteBuf { @Override public boolean isReadable() { - return terminated? buffer.isReadable() : true; + return !terminated || buffer.isReadable(); } @Override public boolean isReadable(int size) { - return terminated? buffer.isReadable(size) : true; + return !terminated || buffer.isReadable(size); } @Override diff --git a/common/src/test/java/io/netty/util/internal/logging/Log4J2LoggerTest.java b/common/src/test/java/io/netty/util/internal/logging/Log4J2LoggerTest.java index a72eb9a2bd..9f86a85268 100644 --- a/common/src/test/java/io/netty/util/internal/logging/Log4J2LoggerTest.java +++ b/common/src/test/java/io/netty/util/internal/logging/Log4J2LoggerTest.java @@ -50,7 +50,7 @@ public class Log4J2LoggerTest extends AbstractInternalLoggerTest { result.put("level", level.name()); result.put("t", t); super.logMessage(fqcn, level, marker, message, t); - }; + } }; } diff --git a/handler/src/main/java/io/netty/handler/ssl/JdkSslContext.java b/handler/src/main/java/io/netty/handler/ssl/JdkSslContext.java index 8473f658b8..eb128fe80e 100644 --- a/handler/src/main/java/io/netty/handler/ssl/JdkSslContext.java +++ b/handler/src/main/java/io/netty/handler/ssl/JdkSslContext.java @@ -102,9 +102,7 @@ public class JdkSslContext extends SslContext { // Choose the sensible default list of protocols. final String[] supportedProtocols = engine.getSupportedProtocols(); Set supportedProtocolsSet = new HashSet(supportedProtocols.length); - for (int i = 0; i < supportedProtocols.length; ++i) { - supportedProtocolsSet.add(supportedProtocols[i]); - } + Collections.addAll(supportedProtocolsSet, supportedProtocols); List protocols = new ArrayList(); addIfSupported( supportedProtocolsSet, protocols, diff --git a/handler/src/main/java/io/netty/handler/ssl/SslUtils.java b/handler/src/main/java/io/netty/handler/ssl/SslUtils.java index f5f28a55d0..661c846bc4 100644 --- a/handler/src/main/java/io/netty/handler/ssl/SslUtils.java +++ b/handler/src/main/java/io/netty/handler/ssl/SslUtils.java @@ -123,9 +123,7 @@ final class SslUtils { // AES256 requires JCE unlimited strength jurisdiction policy files. defaultCiphers.add("TLS_RSA_WITH_AES_256_CBC_SHA"); - for (String tlsv13Cipher: DEFAULT_TLSV13_CIPHER_SUITES) { - defaultCiphers.add(tlsv13Cipher); - } + Collections.addAll(defaultCiphers, DEFAULT_TLSV13_CIPHER_SUITES); DEFAULT_CIPHER_SUITES = defaultCiphers.toArray(new String[0]); }