Merge pull request #49 from motlin/master

Fixes from static-analysis tools.
This commit is contained in:
Norman Maurer 2011-11-09 05:45:56 -08:00
commit 85119dd2fb
28 changed files with 34 additions and 124 deletions

View File

@ -37,13 +37,6 @@ public class DefaultChannelConfig implements ChannelConfig {
private volatile ChannelBufferFactory bufferFactory = HeapChannelBufferFactory.getInstance();
private volatile int connectTimeoutMillis = 10000; // 10 seconds
/**
* Creates a new instance.
*/
public DefaultChannelConfig() {
super();
}
@Override
public void setOptions(Map<String, Object> options) {
for (Entry<String, Object> e: options.entrySet()) {

View File

@ -48,13 +48,6 @@ public class DefaultChannelPipeline implements ChannelPipeline {
private final Map<String, DefaultChannelHandlerContext> name2ctx =
new HashMap<String, DefaultChannelHandlerContext>(4);
/**
* Creates a new empty pipeline.
*/
public DefaultChannelPipeline() {
super();
}
@Override
public Channel getChannel() {
return channel;

View File

@ -35,13 +35,6 @@ public class DefaultServerChannelConfig implements ChannelConfig {
private volatile ChannelPipelineFactory pipelineFactory;
private volatile ChannelBufferFactory bufferFactory = HeapChannelBufferFactory.getInstance();
/**
* Creates a new instance.
*/
public DefaultServerChannelConfig() {
super();
}
@Override
public void setOptions(Map<String, Object> options) {
for (Entry<String, Object> e: options.entrySet()) {

View File

@ -115,7 +115,7 @@ public class IOStreamChannelSink extends AbstractChannelSink {
private PushbackInputStream inputStream;
private ChannelConfig config = new DefaultChannelConfig();
private final ChannelConfig config = new DefaultChannelConfig();
@Override
public void eventSunk(final ChannelPipeline pipeline, final ChannelEvent e) throws Exception {

View File

@ -32,13 +32,6 @@ public class DefaultLocalServerChannelFactory implements LocalServerChannelFacto
private final ChannelSink sink = new LocalServerChannelSink();
/**
* Creates a new instance.
*/
public DefaultLocalServerChannelFactory() {
super();
}
@Override
public LocalServerChannel newChannel(ChannelPipeline pipeline) {
return DefaultLocalServerChannel.create(this, pipeline, sink);

View File

@ -34,7 +34,7 @@ public class RXTXChannelConfig extends DefaultChannelConfig {
STOPBITS_2(SerialPort.STOPBITS_2),
STOPBITS_1_5(SerialPort.STOPBITS_1_5);
private int value;
private final int value;
private Stopbits(int value) {
this.value = value;
@ -61,7 +61,7 @@ public class RXTXChannelConfig extends DefaultChannelConfig {
DATABITS_7(SerialPort.DATABITS_7),
DATABITS_8(SerialPort.DATABITS_8);
private int value;
private final int value;
private Databits(int value) {
this.value = value;
@ -89,7 +89,7 @@ public class RXTXChannelConfig extends DefaultChannelConfig {
MARK(SerialPort.PARITY_MARK),
SPACE(SerialPort.PARITY_SPACE);
private int value;
private final int value;
private Paritybit(int value) {
this.value = value;

View File

@ -32,9 +32,9 @@ import java.util.concurrent.atomic.AtomicLong;
* @author OneDrum Ltd.
*/
class SaturationManager {
private AtomicLong desaturationPoint;
private final AtomicLong desaturationPoint;
private AtomicLong saturationPoint;
private final AtomicLong saturationPoint;
private final AtomicLong queueSize;

View File

@ -30,10 +30,6 @@ final class SocketReceiveBufferPool {
@SuppressWarnings("unchecked")
private final SoftReference<ByteBuffer>[] pool = new SoftReference[POOL_SIZE];
SocketReceiveBufferPool() {
super();
}
final ByteBuffer acquire(int size) {
final SoftReference<ByteBuffer>[] pool = this.pool;
for (int i = 0; i < POOL_SIZE; i ++) {
@ -90,7 +86,7 @@ final class SocketReceiveBufferPool {
}
}
private static final int normalizeCapacity(int capacity) {
private static int normalizeCapacity(int capacity) {
// Normalize to multiple of 1024
int q = capacity >>> 10;
int r = capacity & 1023;

View File

@ -56,14 +56,14 @@ final class SocketSendBufferPool {
"unsupported message type: " + message.getClass());
}
private final SendBuffer acquire(FileRegion src) {
private SendBuffer acquire(FileRegion src) {
if (src.getCount() == 0) {
return EMPTY_BUFFER;
}
return new FileSendBuffer(src);
}
private final SendBuffer acquire(ChannelBuffer src) {
private SendBuffer acquire(ChannelBuffer src) {
final int size = src.readableBytes();
if (size == 0) {
return EMPTY_BUFFER;
@ -109,7 +109,7 @@ final class SocketSendBufferPool {
return dst;
}
private final Preallocation getPreallocation() {
private Preallocation getPreallocation() {
Preallocation current = this.current;
if (current.refCnt == 0) {
current.buffer.clear();
@ -119,7 +119,7 @@ final class SocketSendBufferPool {
return getPreallocation0();
}
private final Preallocation getPreallocation0() {
private Preallocation getPreallocation0() {
PreallocationRef ref = poolHead;
if (ref != null) {
do {
@ -138,7 +138,7 @@ final class SocketSendBufferPool {
return new Preallocation(DEFAULT_PREALLOCATION_SIZE);
}
private static final int align(int pos) {
private static int align(int pos) {
int q = pos >>> ALIGN_SHIFT;
int r = pos & ALIGN_MASK;
if (r != 0) {

View File

@ -404,7 +404,7 @@ public class HttpClient {
// use to simulate a big TEXTAREA field in a form
private static String textArea =
private static final String textArea =
"lkjlkjlKJLKJLKJLKJLJlkj lklkj\r\n\r\nLKJJJJJJJJKKKKKKKKKKKKKKK <20><><EFBFBD><EFBFBD>&\r\n\r\n"+
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\r\n"+
"MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\r\n"+

View File

@ -44,7 +44,7 @@ import java.util.concurrent.Executors;
*/
public class WebSocketClientFactory {
private NioClientSocketChannelFactory socketChannelFactory = new NioClientSocketChannelFactory(
private final NioClientSocketChannelFactory socketChannelFactory = new NioClientSocketChannelFactory(
Executors.newCachedThreadPool(), Executors.newCachedThreadPool());
/**

View File

@ -51,12 +51,12 @@ import org.jboss.netty.util.CharsetUtil;
*/
public class WebSocketClientHandler extends SimpleChannelUpstreamHandler implements WebSocketClient {
private ClientBootstrap bootstrap;
private final ClientBootstrap bootstrap;
private URI url;
private WebSocketCallback callback;
private final WebSocketCallback callback;
private Channel channel;
private WebSocketClientHandshaker handshaker = null;
private WebSocketSpecificationVersion version;
private final WebSocketSpecificationVersion version;
public WebSocketClientHandler(ClientBootstrap bootstrap, URI url, WebSocketSpecificationVersion version, WebSocketCallback callback) {
this.bootstrap = bootstrap;

View File

@ -48,7 +48,7 @@ public final class LocalTimeProtocol {
internalGetValueMap() {
return internalValueMap;
}
private static com.google.protobuf.Internal.EnumLiteMap<Continent>
private static final com.google.protobuf.Internal.EnumLiteMap<Continent>
internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap<Continent>() {
public Continent findValueByNumber(int number) {
@ -125,7 +125,7 @@ public final class LocalTimeProtocol {
internalGetValueMap() {
return internalValueMap;
}
private static com.google.protobuf.Internal.EnumLiteMap<DayOfWeek>
private static final com.google.protobuf.Internal.EnumLiteMap<DayOfWeek>
internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap<DayOfWeek>() {
public DayOfWeek findValueByNumber(int number) {

View File

@ -53,21 +53,21 @@ public class Base64 {
private static final byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding
private static final byte[] alphabet(Base64Dialect dialect) {
private static byte[] alphabet(Base64Dialect dialect) {
if (dialect == null) {
throw new NullPointerException("dialect");
}
return dialect.alphabet;
}
private static final byte[] decodabet(Base64Dialect dialect) {
private static byte[] decodabet(Base64Dialect dialect) {
if (dialect == null) {
throw new NullPointerException("dialect");
}
return dialect.decodabet;
}
private static final boolean breakLines(Base64Dialect dialect) {
private static boolean breakLines(Base64Dialect dialect) {
if (dialect == null) {
throw new NullPointerException("dialect");
}

View File

@ -24,8 +24,4 @@ import java.net.SocketAddress;
*/
class EmbeddedSocketAddress extends SocketAddress {
private static final long serialVersionUID = 1400788804624980619L;
EmbeddedSocketAddress() {
super();
}
}

View File

@ -50,7 +50,7 @@ public class DefaultHttpDataFactory implements HttpDataFactory {
/**
* Keep all HttpDatas until cleanAllHttpDatas() is called.
*/
private ConcurrentHashMap<HttpRequest, List<HttpData>> requestFileDeleteMap =
private final ConcurrentHashMap<HttpRequest, List<HttpData>> requestFileDeleteMap =
new ConcurrentHashMap<HttpRequest, List<HttpData>>();
/**
* HttpData will be in memory if less than default size (16KB).

View File

@ -1435,12 +1435,6 @@ public class HttpPostRequestDecoder {
*/
private static final long serialVersionUID = 1336267941020800769L;
/**
*
*/
public EndOfDataDecoderException() {
super();
}
}
/**

View File

@ -49,7 +49,7 @@ public class WebSocketClientHandshaker10 extends WebSocketClientHandshaker {
private String expectedChallengeResponseString = null;
private String protocol = null;
private final String protocol = null;
private boolean allowExtensions = false;

View File

@ -30,9 +30,9 @@ import org.jboss.netty.handler.codec.http.HttpHeaders.Names;
*/
public class WebSocketServerHandshakerFactory {
private String webSocketURL;
private final String webSocketURL;
private String subProtocols;
private final String subProtocols;
private boolean allowExtensions = false;
@ -60,16 +60,6 @@ public class WebSocketServerHandshakerFactory {
/**
* Instances a new handshaker
*
* @param webSocketURL
* URL for web socket communications. e.g
* "ws://myhost.com/mypath". Subsequent web socket frames will be
* sent to this URL.
* @param version
* Version of web socket specification to use to connect to the
* server
* @param subProtocol
* Sub protocol request sent to the server. Null if no
* sub-protocol support is required.
* @return A new WebSocketServerHandshaker for the requested web socket
* version. Null if web socket version is not supported.
*/

View File

@ -68,13 +68,6 @@ import com.google.protobuf.MessageLite;
@Sharable
public class ProtobufEncoder extends OneToOneEncoder {
/**
* Creates a new instance.
*/
public ProtobufEncoder() {
super();
}
@Override
protected Object encode(
ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception {

View File

@ -27,7 +27,4 @@ class ReplayError extends Error {
private static final long serialVersionUID = 2666698631187527681L;
ReplayError() {
super();
}
}

View File

@ -86,13 +86,6 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns
private ChannelHandlerContext ctx;
private MessageEvent currentEvent;
/**
* Creates a new instance.
*/
public ChunkedWriteHandler() {
super();
}
/**
* Continues to fetch the chunks from the input.
*/

View File

@ -32,13 +32,6 @@ import org.jboss.netty.channel.SimpleChannelHandler;
*/
public class IdleStateAwareChannelHandler extends SimpleChannelHandler {
/**
* Creates a new instance.
*/
public IdleStateAwareChannelHandler() {
super();
}
@Override
public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e)
throws Exception {

View File

@ -32,13 +32,6 @@ import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
*/
public class IdleStateAwareChannelUpstreamHandler extends SimpleChannelUpstreamHandler {
/**
* Creates a new instance.
*/
public IdleStateAwareChannelUpstreamHandler() {
super();
}
@Override
public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e)
throws Exception {

View File

@ -29,9 +29,6 @@ class AtomicFieldUpdaterUtil {
static final class Node {
volatile Node next;
Node() {
super();
}
}
static {

View File

@ -494,26 +494,26 @@ final class Deflate {
// Output a byte on the stream.
// IN assertion: there is enough room in pending_buf.
private final void put_byte(byte[] p, int start, int len) {
private void put_byte(byte[] p, int start, int len) {
System.arraycopy(p, start, pending_buf, pending, len);
pending += len;
}
private final void put_byte(byte c) {
private void put_byte(byte c) {
pending_buf[pending ++] = c;
}
private final void put_short(int w) {
private void put_short(int w) {
put_byte((byte) w/*&0xff*/);
put_byte((byte) (w >>> 8));
}
private final void putShortMSB(int b) {
private void putShortMSB(int b) {
put_byte((byte) (b >> 8));
put_byte((byte) b/*&0xff*/);
}
private final void send_code(int c, short[] tree) {
private void send_code(int c, short[] tree) {
int c2 = c * 2;
send_bits((tree[c2] & 0xffff), (tree[c2 + 1] & 0xffff));
}

View File

@ -85,10 +85,6 @@ final class InfCodes {
private int[] dtree; // distance tree
private int dtree_index; // distance tree
InfCodes() {
super();
}
void init(int bl, int bd, int[] tl, int tl_index, int[] td, int td_index) {
mode = START;
lbits = (byte) bl;

View File

@ -85,7 +85,7 @@ public class HttpTunnelSoakTester {
final DataVerifier s2cVerifier = new DataVerifier("S2C-Verifier");
private static byte[] SEND_STREAM;
private static final byte[] SEND_STREAM;
static {
SEND_STREAM = new byte[MAX_WRITE_SIZE + 127];