From bf0bfe9a6949b15e3954ee9ccb7905e4eb12774d Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Mon, 11 Feb 2013 16:52:43 +0900 Subject: [PATCH] Fix inspector warnings --- .../buffer/IllegalBufferAccessException.java | 2 +- .../multipart/HttpPostRequestDecoderTest.java | 23 +++++++++++-------- .../example/udt/util/UtilThreadFactory.java | 2 +- .../transport/sctp/AbstractSctpTest.java | 1 - .../transport/sctp/SctpTestPermutation.java | 7 +++--- .../netty/channel/rxtx/RxtxChannelConfig.java | 14 +++++------ .../netty/channel/udt/UdtServerChannel.java | 2 -- .../netty/test/udt/nio/AbstractUdtTest.java | 4 +--- .../java/io/netty/channel/ChannelConfig.java | 8 +++---- .../netty/channel/ChannelTaskScheduler.java | 10 ++++++++ .../channel/socket/DatagramChannelConfig.java | 22 ++++++++++-------- .../netty/channel/nio/NioEventLoopTest.java | 3 +-- 12 files changed, 53 insertions(+), 45 deletions(-) diff --git a/buffer/src/main/java/io/netty/buffer/IllegalBufferAccessException.java b/buffer/src/main/java/io/netty/buffer/IllegalBufferAccessException.java index e29370b8e0..52b10294a7 100644 --- a/buffer/src/main/java/io/netty/buffer/IllegalBufferAccessException.java +++ b/buffer/src/main/java/io/netty/buffer/IllegalBufferAccessException.java @@ -18,7 +18,7 @@ package io.netty.buffer; /** * An {@link IllegalStateException} raised when a user attempts to access a {@link Buf} which was freed by - * {@link Buf#free()} already. + * {@link Buf#release()} } already. */ public class IllegalBufferAccessException extends IllegalStateException { diff --git a/codec-http/src/test/java/io/netty/handler/codec/http/multipart/HttpPostRequestDecoderTest.java b/codec-http/src/test/java/io/netty/handler/codec/http/multipart/HttpPostRequestDecoderTest.java index 495a8aee12..d58922008c 100644 --- a/codec-http/src/test/java/io/netty/handler/codec/http/multipart/HttpPostRequestDecoderTest.java +++ b/codec-http/src/test/java/io/netty/handler/codec/http/multipart/HttpPostRequestDecoderTest.java @@ -17,14 +17,17 @@ package io.netty.handler.codec.http.multipart; import io.netty.buffer.Unpooled; import io.netty.handler.codec.DecoderResult; -import io.netty.handler.codec.http.*; +import io.netty.handler.codec.http.DefaultHttpContent; +import io.netty.handler.codec.http.DefaultHttpRequest; +import io.netty.handler.codec.http.HttpHeaders; +import io.netty.handler.codec.http.HttpMethod; +import io.netty.handler.codec.http.HttpVersion; import io.netty.util.CharsetUtil; import org.junit.Test; import java.util.Arrays; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; /** {@link HttpPostRequestDecoder} test case. */ public class HttpPostRequestDecoderTest { @@ -42,13 +45,13 @@ public class HttpPostRequestDecoderTest { final DefaultHttpDataFactory inMemoryFactory = new DefaultHttpDataFactory(false); for (String data : Arrays.asList("", "\r", "\r\r", "\r\r\r")) { - final String body = "" - + "--" + boundary + "\r\n" + - "Content-Disposition: form-data; name=\"file\"; filename=\"tmp-0.txt\"\r\n" + - "Content-Type: image/gif\r\n" + - "\r\n" + - data + "\r\n" + - "--" + boundary + "--\r\n"; + final String body = + "--" + boundary + "\r\n" + + "Content-Disposition: form-data; name=\"file\"; filename=\"tmp-0.txt\"\r\n" + + "Content-Type: image/gif\r\n" + + "\r\n" + + data + "\r\n" + + "--" + boundary + "--\r\n"; // Create decoder instance to test. final HttpPostRequestDecoder decoder = new HttpPostRequestDecoder(inMemoryFactory, req); diff --git a/example/src/main/java/io/netty/example/udt/util/UtilThreadFactory.java b/example/src/main/java/io/netty/example/udt/util/UtilThreadFactory.java index fb145ed89a..05b08e54b2 100644 --- a/example/src/main/java/io/netty/example/udt/util/UtilThreadFactory.java +++ b/example/src/main/java/io/netty/example/udt/util/UtilThreadFactory.java @@ -34,6 +34,6 @@ public class UtilThreadFactory implements ThreadFactory { @Override public Thread newThread(final Runnable runnable) { - return new Thread(runnable, name + "-" + counter.getAndIncrement()); + return new Thread(runnable, name + '-' + counter.getAndIncrement()); } } diff --git a/testsuite/src/test/java/io/netty/testsuite/transport/sctp/AbstractSctpTest.java b/testsuite/src/test/java/io/netty/testsuite/transport/sctp/AbstractSctpTest.java index ba46477ca1..ac9be12472 100644 --- a/testsuite/src/test/java/io/netty/testsuite/transport/sctp/AbstractSctpTest.java +++ b/testsuite/src/test/java/io/netty/testsuite/transport/sctp/AbstractSctpTest.java @@ -19,7 +19,6 @@ import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.ServerBootstrap; import io.netty.logging.InternalLogger; import io.netty.logging.InternalLoggerFactory; -import io.netty.testsuite.transport.sctp.SctpTestPermutation; import io.netty.testsuite.transport.sctp.SctpTestPermutation.Factory; import io.netty.testsuite.util.TestUtils; import io.netty.util.NetUtil; diff --git a/testsuite/src/test/java/io/netty/testsuite/transport/sctp/SctpTestPermutation.java b/testsuite/src/test/java/io/netty/testsuite/transport/sctp/SctpTestPermutation.java index db6b467d80..f152648be5 100644 --- a/testsuite/src/test/java/io/netty/testsuite/transport/sctp/SctpTestPermutation.java +++ b/testsuite/src/test/java/io/netty/testsuite/transport/sctp/SctpTestPermutation.java @@ -17,12 +17,12 @@ package io.netty.testsuite.transport.sctp; import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.oio.OioEventLoopGroup; import io.netty.channel.sctp.nio.NioSctpChannel; import io.netty.channel.sctp.nio.NioSctpServerChannel; import io.netty.channel.sctp.oio.OioSctpChannel; import io.netty.channel.sctp.oio.OioSctpServerChannel; -import io.netty.channel.nio.NioEventLoopGroup; -import io.netty.channel.oio.OioEventLoopGroup; import io.netty.testsuite.util.TestUtils; import java.util.ArrayList; @@ -30,8 +30,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; -public class SctpTestPermutation { - +public final class SctpTestPermutation { static List> sctpServerChannel() { if (!TestUtils.isSctpSupported()) { diff --git a/transport-rxtx/src/main/java/io/netty/channel/rxtx/RxtxChannelConfig.java b/transport-rxtx/src/main/java/io/netty/channel/rxtx/RxtxChannelConfig.java index d5dd29673e..4d64af6aca 100644 --- a/transport-rxtx/src/main/java/io/netty/channel/rxtx/RxtxChannelConfig.java +++ b/transport-rxtx/src/main/java/io/netty/channel/rxtx/RxtxChannelConfig.java @@ -31,19 +31,19 @@ import io.netty.channel.ChannelConfig; * * NameAssociated setter method * - * {@link io.netty.channel.rxtx.RxtxChannelOption#BAUD_RATE}{@link #setBaudrate(int)} + * {@link RxtxChannelOption#BAUD_RATE}{@link #setBaudrate(int)} * - * {@link io.netty.channel.rxtx.RxtxChannelOption#DTR}{@link #setDtr(boolean)} + * {@link RxtxChannelOption#DTR}{@link #setDtr(boolean)} * - * {@link io.netty.channel.rxtx.RxtxChannelOption#RTS}{@link #setRts(boolean)} + * {@link RxtxChannelOption#RTS}{@link #setRts(boolean)} * - * {@link io.netty.channel.rxtx.RxtxChannelOption#STOP_BITS}{@link #setStopbits(Stopbits)} + * {@link RxtxChannelOption#STOP_BITS}{@link #setStopbits(Stopbits)} * - * {@link io.netty.channel.rxtx.RxtxChannelOption#DATA_BITS}{@link #setDatabits(Databits)} + * {@link RxtxChannelOption#DATA_BITS}{@link #setDatabits(Databits)} * - * {@link io.netty.channel.rxtx.RxtxChannelOption#PARITY_BIT}{@link #setParitybit(Paritybit)} + * {@link RxtxChannelOption#PARITY_BIT}{@link #setParitybit(Paritybit)} * - * {@link io.netty.channel.rxtx.RxtxChannelOption#WAIT_TIME}{@link #setWaitTimeMillis(int)} + * {@link RxtxChannelOption#WAIT_TIME}{@link #setWaitTimeMillis(int)} * * */ diff --git a/transport-udt/src/main/java/io/netty/channel/udt/UdtServerChannel.java b/transport-udt/src/main/java/io/netty/channel/udt/UdtServerChannel.java index b0b9532be7..a04d195122 100644 --- a/transport-udt/src/main/java/io/netty/channel/udt/UdtServerChannel.java +++ b/transport-udt/src/main/java/io/netty/channel/udt/UdtServerChannel.java @@ -18,8 +18,6 @@ package io.netty.channel.udt; import io.netty.channel.ServerChannel; import io.netty.channel.udt.nio.NioUdtProvider; -import java.net.InetSocketAddress; - /** * UDT {@link ServerChannel}. *

diff --git a/transport-udt/src/test/java/io/netty/test/udt/nio/AbstractUdtTest.java b/transport-udt/src/test/java/io/netty/test/udt/nio/AbstractUdtTest.java index e95443dfad..ba27358342 100644 --- a/transport-udt/src/test/java/io/netty/test/udt/nio/AbstractUdtTest.java +++ b/transport-udt/src/test/java/io/netty/test/udt/nio/AbstractUdtTest.java @@ -16,12 +16,10 @@ package io.netty.test.udt.nio; -import static org.junit.Assume.*; import io.netty.test.udt.util.UnitHelp; - import org.junit.BeforeClass; -import com.barchart.udt.SocketUDT; +import static org.junit.Assume.*; /** * Base for UDT tests. diff --git a/transport/src/main/java/io/netty/channel/ChannelConfig.java b/transport/src/main/java/io/netty/channel/ChannelConfig.java index d2b9442955..ea0bcfb9ab 100644 --- a/transport/src/main/java/io/netty/channel/ChannelConfig.java +++ b/transport/src/main/java/io/netty/channel/ChannelConfig.java @@ -46,13 +46,13 @@ import java.util.Map; * * NameAssociated setter method * - * {@link io.netty.channel.ChannelOption#CONNECT_TIMEOUT_MILLIS}{@link #setConnectTimeoutMillis(int)} + * {@link ChannelOption#CONNECT_TIMEOUT_MILLIS}{@link #setConnectTimeoutMillis(int)} * - * {@link io.netty.channel.ChannelOption#WRITE_SPIN_COUNT}{@link #setWriteSpinCount(int)} + * {@link ChannelOption#WRITE_SPIN_COUNT}{@link #setWriteSpinCount(int)} * - * {@link io.netty.channel.ChannelOption#ALLOCATOR}{@link #setAllocator(ByteBufAllocator)} + * {@link ChannelOption#ALLOCATOR}{@link #setAllocator(ByteBufAllocator)} * - * {@link io.netty.channel.ChannelOption#AUTO_READ}{@link #setAutoRead(boolean)} + * {@link ChannelOption#AUTO_READ}{@link #setAutoRead(boolean)} * * *

diff --git a/transport/src/main/java/io/netty/channel/ChannelTaskScheduler.java b/transport/src/main/java/io/netty/channel/ChannelTaskScheduler.java index 2ac25c5cf5..3d0875c75d 100644 --- a/transport/src/main/java/io/netty/channel/ChannelTaskScheduler.java +++ b/transport/src/main/java/io/netty/channel/ChannelTaskScheduler.java @@ -369,6 +369,16 @@ public final class ChannelTaskScheduler { return unit.convert(delayNanos(), TimeUnit.NANOSECONDS); } + @Override + public int hashCode() { + return System.identityHashCode(this); + } + + @Override + public boolean equals(Object obj) { + return this == obj; + } + @Override public int compareTo(Delayed o) { if (this == o) { diff --git a/transport/src/main/java/io/netty/channel/socket/DatagramChannelConfig.java b/transport/src/main/java/io/netty/channel/socket/DatagramChannelConfig.java index 0a2517244c..6c296d7c3c 100644 --- a/transport/src/main/java/io/netty/channel/socket/DatagramChannelConfig.java +++ b/transport/src/main/java/io/netty/channel/socket/DatagramChannelConfig.java @@ -17,6 +17,8 @@ package io.netty.channel.socket; import io.netty.buffer.ByteBufAllocator; import io.netty.channel.ChannelConfig; +import io.netty.channel.ChannelOption; + import java.net.InetAddress; import java.net.NetworkInterface; import java.net.StandardSocketOptions; @@ -33,27 +35,27 @@ import java.net.StandardSocketOptions; * * NameAssociated setter method * - * {@link io.netty.channel.ChannelOption#SO_BROADCAST}{@link #setBroadcast(boolean)} + * {@link ChannelOption#SO_BROADCAST}{@link #setBroadcast(boolean)} * - * {@link io.netty.channel.ChannelOption#IP_MULTICAST_ADDR}{@link #setInterface(InetAddress)} + * {@link ChannelOption#IP_MULTICAST_ADDR}{@link #setInterface(InetAddress)} * - * {@link io.netty.channel.ChannelOption#IP_MULTICAST_LOOP_DISABLED} + * {@link ChannelOption#IP_MULTICAST_LOOP_DISABLED} * {@link #setLoopbackModeDisabled(boolean)} * - * {@link io.netty.channel.ChannelOption#IP_MULTICAST_IF} + * {@link ChannelOption#IP_MULTICAST_IF} * {@link #setNetworkInterface(NetworkInterface)} * - * {@link io.netty.channel.ChannelOption#SO_REUSEADDR}{@link #setReuseAddress(boolean)} + * {@link ChannelOption#SO_REUSEADDR}{@link #setReuseAddress(boolean)} * - * {@link io.netty.channel.ChannelOption#SO_RCVBUF}{@link #setReceiveBufferSize(int)} + * {@link ChannelOption#SO_RCVBUF}{@link #setReceiveBufferSize(int)} * - * {@link io.netty.channel.ChannelOption#SO_SNDBUF}{@link #setSendBufferSize(int)} + * {@link ChannelOption#SO_SNDBUF}{@link #setSendBufferSize(int)} * - * {@link io.netty.channel.ChannelOption#IP_MULTICAST_TTL}{@link #setTimeToLive(int)} + * {@link ChannelOption#IP_MULTICAST_TTL}{@link #setTimeToLive(int)} * - * {@link io.netty.channel.ChannelOption#IP_TOS}{@link #setTrafficClass(int)} + * {@link ChannelOption#IP_TOS}{@link #setTrafficClass(int)} * - * {@link io.netty.channel.ChannelOption#UDP_RECEIVE_PACKET_SIZE}{@link #setReceivePacketSize(int)} + * {@link ChannelOption#UDP_RECEIVE_PACKET_SIZE}{@link #setReceivePacketSize(int)} * * */ diff --git a/transport/src/test/java/io/netty/channel/nio/NioEventLoopTest.java b/transport/src/test/java/io/netty/channel/nio/NioEventLoopTest.java index e75491e65f..979e80ee98 100644 --- a/transport/src/test/java/io/netty/channel/nio/NioEventLoopTest.java +++ b/transport/src/test/java/io/netty/channel/nio/NioEventLoopTest.java @@ -17,9 +17,8 @@ package io.netty.channel.nio; import io.netty.channel.AbstractEventLoopTest; import io.netty.channel.EventLoopGroup; -import io.netty.channel.nio.NioEventLoopGroup; -import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.channel.socket.ServerSocketChannel; +import io.netty.channel.socket.nio.NioServerSocketChannel; public class NioEventLoopTest extends AbstractEventLoopTest {