Merge pull request #496 from CruzBishop/static-fixes
Some static analysis fixes
This commit is contained in:
commit
963b7c20ac
@ -62,14 +62,14 @@ public class BigEndianHeapChannelBuffer extends HeapChannelBuffer {
|
||||
public int getUnsignedMedium(int index) {
|
||||
return (array[index] & 0xff) << 16 |
|
||||
(array[index + 1] & 0xff) << 8 |
|
||||
(array[index + 2] & 0xff) << 0;
|
||||
(array[index + 2] & 0xff);
|
||||
}
|
||||
|
||||
public int getInt(int index) {
|
||||
return (array[index] & 0xff) << 24 |
|
||||
(array[index + 1] & 0xff) << 16 |
|
||||
(array[index + 2] & 0xff) << 8 |
|
||||
(array[index + 3] & 0xff) << 0;
|
||||
(array[index + 3] & 0xff);
|
||||
}
|
||||
|
||||
public long getLong(int index) {
|
||||
@ -80,25 +80,25 @@ public class BigEndianHeapChannelBuffer extends HeapChannelBuffer {
|
||||
((long) array[index + 4] & 0xff) << 24 |
|
||||
((long) array[index + 5] & 0xff) << 16 |
|
||||
((long) array[index + 6] & 0xff) << 8 |
|
||||
((long) array[index + 7] & 0xff) << 0;
|
||||
((long) array[index + 7] & 0xff);
|
||||
}
|
||||
|
||||
public void setShort(int index, int value) {
|
||||
array[index] = (byte) (value >>> 8);
|
||||
array[index + 1] = (byte) (value >>> 0);
|
||||
array[index + 1] = (byte) value;
|
||||
}
|
||||
|
||||
public void setMedium(int index, int value) {
|
||||
array[index] = (byte) (value >>> 16);
|
||||
array[index + 1] = (byte) (value >>> 8);
|
||||
array[index + 2] = (byte) (value >>> 0);
|
||||
array[index + 2] = (byte) value;
|
||||
}
|
||||
|
||||
public void setInt(int index, int value) {
|
||||
array[index] = (byte) (value >>> 24);
|
||||
array[index + 1] = (byte) (value >>> 16);
|
||||
array[index + 2] = (byte) (value >>> 8);
|
||||
array[index + 3] = (byte) (value >>> 0);
|
||||
array[index + 3] = (byte) value;
|
||||
}
|
||||
|
||||
public void setLong(int index, long value) {
|
||||
@ -109,7 +109,7 @@ public class BigEndianHeapChannelBuffer extends HeapChannelBuffer {
|
||||
array[index + 4] = (byte) (value >>> 24);
|
||||
array[index + 5] = (byte) (value >>> 16);
|
||||
array[index + 6] = (byte) (value >>> 8);
|
||||
array[index + 7] = (byte) (value >>> 0);
|
||||
array[index + 7] = (byte) value;
|
||||
}
|
||||
|
||||
public ChannelBuffer duplicate() {
|
||||
|
@ -99,7 +99,7 @@ public class ByteBufferBackedChannelBuffer extends AbstractChannelBuffer {
|
||||
public int getUnsignedMedium(int index) {
|
||||
return (getByte(index) & 0xff) << 16 |
|
||||
(getByte(index + 1) & 0xff) << 8 |
|
||||
(getByte(index + 2) & 0xff) << 0;
|
||||
(getByte(index + 2) & 0xff);
|
||||
}
|
||||
|
||||
public int getInt(int index) {
|
||||
@ -158,7 +158,7 @@ public class ByteBufferBackedChannelBuffer extends AbstractChannelBuffer {
|
||||
public void setMedium(int index, int value) {
|
||||
setByte(index, (byte) (value >>> 16));
|
||||
setByte(index + 1, (byte) (value >>> 8));
|
||||
setByte(index + 2, (byte) (value >>> 0));
|
||||
setByte(index + 2, (byte) value);
|
||||
}
|
||||
|
||||
public void setInt(int index, int value) {
|
||||
|
@ -107,8 +107,8 @@ public final class ChannelBuffers {
|
||||
static {
|
||||
final char[] DIGITS = "0123456789abcdef".toCharArray();
|
||||
for (int i = 0; i < 256; i ++) {
|
||||
HEXDUMP_TABLE[(i << 1) + 0] = DIGITS[i >>> 4 & 0x0F];
|
||||
HEXDUMP_TABLE[(i << 1) + 1] = DIGITS[i >>> 0 & 0x0F];
|
||||
HEXDUMP_TABLE[i << 1] = DIGITS[i >>> 4 & 0x0F];
|
||||
HEXDUMP_TABLE[(i << 1) + 1] = DIGITS[i & 0x0F];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,20 +60,20 @@ public class LittleEndianHeapChannelBuffer extends HeapChannelBuffer {
|
||||
}
|
||||
|
||||
public int getUnsignedMedium(int index) {
|
||||
return (array[index] & 0xff) << 0 |
|
||||
return (array[index] & 0xff) |
|
||||
(array[index + 1] & 0xff) << 8 |
|
||||
(array[index + 2] & 0xff) << 16;
|
||||
}
|
||||
|
||||
public int getInt(int index) {
|
||||
return (array[index] & 0xff) << 0 |
|
||||
return (array[index] & 0xff) |
|
||||
(array[index + 1] & 0xff) << 8 |
|
||||
(array[index + 2] & 0xff) << 16 |
|
||||
(array[index + 3] & 0xff) << 24;
|
||||
}
|
||||
|
||||
public long getLong(int index) {
|
||||
return ((long) array[index] & 0xff) << 0 |
|
||||
return ((long) array[index] & 0xff) |
|
||||
((long) array[index + 1] & 0xff) << 8 |
|
||||
((long) array[index + 2] & 0xff) << 16 |
|
||||
((long) array[index + 3] & 0xff) << 24 |
|
||||
@ -84,25 +84,25 @@ public class LittleEndianHeapChannelBuffer extends HeapChannelBuffer {
|
||||
}
|
||||
|
||||
public void setShort(int index, int value) {
|
||||
array[index] = (byte) (value >>> 0);
|
||||
array[index] = (byte) value;
|
||||
array[index + 1] = (byte) (value >>> 8);
|
||||
}
|
||||
|
||||
public void setMedium(int index, int value) {
|
||||
array[index] = (byte) (value >>> 0);
|
||||
array[index] = (byte) value;
|
||||
array[index + 1] = (byte) (value >>> 8);
|
||||
array[index + 2] = (byte) (value >>> 16);
|
||||
}
|
||||
|
||||
public void setInt(int index, int value) {
|
||||
array[index] = (byte) (value >>> 0);
|
||||
array[index] = (byte) value;
|
||||
array[index + 1] = (byte) (value >>> 8);
|
||||
array[index + 2] = (byte) (value >>> 16);
|
||||
array[index + 3] = (byte) (value >>> 24);
|
||||
}
|
||||
|
||||
public void setLong(int index, long value) {
|
||||
array[index] = (byte) (value >>> 0);
|
||||
array[index] = (byte) value;
|
||||
array[index + 1] = (byte) (value >>> 8);
|
||||
array[index + 2] = (byte) (value >>> 16);
|
||||
array[index + 3] = (byte) (value >>> 24);
|
||||
|
@ -28,7 +28,7 @@ public abstract class AbstractChannel implements Channel {
|
||||
static final ConcurrentMap<Integer, Channel> allChannels = new ConcurrentHashMap<Integer, Channel>();
|
||||
|
||||
private static Integer allocateId(Channel channel) {
|
||||
Integer id = Integer.valueOf(System.identityHashCode(channel));
|
||||
Integer id = System.identityHashCode(channel);
|
||||
for (;;) {
|
||||
// Loop until a unique ID is acquired.
|
||||
// It should be found in one loop practically.
|
||||
@ -37,7 +37,7 @@ public abstract class AbstractChannel implements Channel {
|
||||
return id;
|
||||
} else {
|
||||
// Taken by other channel at almost the same moment.
|
||||
id = Integer.valueOf(id.intValue() + 1);
|
||||
id = id.intValue() + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -751,7 +751,7 @@ public final class Channels {
|
||||
|
||||
ChannelFuture future = future(channel);
|
||||
channel.getPipeline().sendDownstream(new DownstreamChannelStateEvent(
|
||||
channel, future, ChannelState.INTEREST_OPS, Integer.valueOf(interestOps)));
|
||||
channel, future, ChannelState.INTEREST_OPS, interestOps));
|
||||
return future;
|
||||
}
|
||||
|
||||
@ -772,8 +772,7 @@ public final class Channels {
|
||||
|
||||
ctx.sendDownstream(
|
||||
new DownstreamChannelStateEvent(
|
||||
ctx.getChannel(), future, ChannelState.INTEREST_OPS,
|
||||
Integer.valueOf(interestOps)));
|
||||
ctx.getChannel(), future, ChannelState.INTEREST_OPS, interestOps));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -116,7 +116,7 @@ public class FactorialClientHandler extends SimpleChannelUpstreamHandler {
|
||||
Channel channel = e.getChannel();
|
||||
while (channel.isWritable()) {
|
||||
if (i <= count) {
|
||||
channel.write(Integer.valueOf(i));
|
||||
channel.write(i);
|
||||
i ++;
|
||||
} else {
|
||||
break;
|
||||
|
@ -52,7 +52,7 @@ public class ObjectEchoClientHandler extends SimpleChannelUpstreamHandler {
|
||||
}
|
||||
firstMessage = new ArrayList<Integer>(firstMessageSize);
|
||||
for (int i = 0; i < firstMessageSize; i ++) {
|
||||
firstMessage.add(Integer.valueOf(i));
|
||||
firstMessage.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ import org.jboss.netty.channel.DefaultChannelConfig;
|
||||
*/
|
||||
class EmbeddedChannel extends AbstractChannel {
|
||||
|
||||
private static final Integer DUMMY_ID = Integer.valueOf(0);
|
||||
private static final Integer DUMMY_ID = 0;
|
||||
|
||||
private final ChannelConfig config;
|
||||
private final SocketAddress localAddress = new EmbeddedSocketAddress();
|
||||
|
@ -153,7 +153,7 @@ public class DefaultCookie implements Cookie {
|
||||
if (p <= 0 || p > 65535) {
|
||||
throw new IllegalArgumentException("port out of range: " + p);
|
||||
}
|
||||
newPorts.add(Integer.valueOf(p));
|
||||
newPorts.add(p);
|
||||
}
|
||||
this.ports = newPorts;
|
||||
unmodifiablePorts = null;
|
||||
@ -166,7 +166,7 @@ public class DefaultCookie implements Cookie {
|
||||
if (p <= 0 || p > 65535) {
|
||||
throw new IllegalArgumentException("port out of range: " + p);
|
||||
}
|
||||
newPorts.add(Integer.valueOf(p));
|
||||
newPorts.add(p);
|
||||
}
|
||||
if (newPorts.isEmpty()) {
|
||||
unmodifiablePorts = this.ports = Collections.emptySet();
|
||||
|
@ -44,12 +44,12 @@ public class DefaultSpdySettingsFrame implements SpdySettingsFrame {
|
||||
}
|
||||
|
||||
public boolean isSet(int ID) {
|
||||
Integer key = new Integer(ID);
|
||||
Integer key = ID;
|
||||
return settingsMap.containsKey(key);
|
||||
}
|
||||
|
||||
public int getValue(int ID) {
|
||||
Integer key = new Integer(ID);
|
||||
Integer key = ID;
|
||||
if (settingsMap.containsKey(key)) {
|
||||
return settingsMap.get(key).getValue();
|
||||
} else {
|
||||
@ -65,7 +65,7 @@ public class DefaultSpdySettingsFrame implements SpdySettingsFrame {
|
||||
if (ID <= 0 || ID > SpdyCodecUtil.SPDY_SETTINGS_MAX_ID) {
|
||||
throw new IllegalArgumentException("Setting ID is not valid: " + ID);
|
||||
}
|
||||
Integer key = new Integer(ID);
|
||||
Integer key = ID;
|
||||
if (settingsMap.containsKey(key)) {
|
||||
Setting setting = settingsMap.get(key);
|
||||
setting.setValue(value);
|
||||
@ -77,7 +77,7 @@ public class DefaultSpdySettingsFrame implements SpdySettingsFrame {
|
||||
}
|
||||
|
||||
public void removeValue(int ID) {
|
||||
Integer key = new Integer(ID);
|
||||
Integer key = ID;
|
||||
if (settingsMap.containsKey(key)) {
|
||||
settingsMap.remove(key);
|
||||
}
|
||||
@ -88,7 +88,7 @@ public class DefaultSpdySettingsFrame implements SpdySettingsFrame {
|
||||
}
|
||||
|
||||
public boolean isPersistValue(int ID) {
|
||||
Integer key = new Integer(ID);
|
||||
Integer key = ID;
|
||||
if (settingsMap.containsKey(key)) {
|
||||
return settingsMap.get(key).isPersist();
|
||||
} else {
|
||||
@ -97,14 +97,14 @@ public class DefaultSpdySettingsFrame implements SpdySettingsFrame {
|
||||
}
|
||||
|
||||
public void setPersistValue(int ID, boolean persistValue) {
|
||||
Integer key = new Integer(ID);
|
||||
Integer key = ID;
|
||||
if (settingsMap.containsKey(key)) {
|
||||
settingsMap.get(key).setPersist(persistValue);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isPersisted(int ID) {
|
||||
Integer key = new Integer(ID);
|
||||
Integer key = ID;
|
||||
if (settingsMap.containsKey(key)) {
|
||||
return settingsMap.get(key).isPersisted();
|
||||
} else {
|
||||
@ -113,7 +113,7 @@ public class DefaultSpdySettingsFrame implements SpdySettingsFrame {
|
||||
}
|
||||
|
||||
public void setPersisted(int ID, boolean persisted) {
|
||||
Integer key = new Integer(ID);
|
||||
Integer key = ID;
|
||||
if (settingsMap.containsKey(key)) {
|
||||
settingsMap.get(key).setPersisted(persisted);
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ public class SpdyFrameEncoder implements ChannelDownstreamHandler {
|
||||
// Chromium Issue 79156
|
||||
// SPDY setting ids are not written in network byte order
|
||||
// Write id assuming the architecture is little endian
|
||||
frame.writeByte(id >> 0 & 0xFF);
|
||||
frame.writeByte(id & 0xFF);
|
||||
frame.writeByte(id >> 8 & 0xFF);
|
||||
frame.writeByte(id >> 16 & 0xFF);
|
||||
frame.writeByte(ID_flags);
|
||||
|
@ -127,7 +127,7 @@ public class SpdyHttpDecoder extends OneToOneDecoder {
|
||||
return httpResponse;
|
||||
} else {
|
||||
// Response body will follow in a series of Data Frames
|
||||
messageMap.put(new Integer(streamID), httpResponse);
|
||||
messageMap.put(streamID, httpResponse);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SpdyRstStreamFrame spdyRstStreamFrame =
|
||||
@ -147,7 +147,7 @@ public class SpdyHttpDecoder extends OneToOneDecoder {
|
||||
return httpRequest;
|
||||
} else {
|
||||
// Request body will follow in a series of Data Frames
|
||||
messageMap.put(new Integer(streamID), httpRequest);
|
||||
messageMap.put(streamID, httpRequest);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// If a client sends a SYN_STREAM without all of the method, url (host and path),
|
||||
@ -177,7 +177,7 @@ public class SpdyHttpDecoder extends OneToOneDecoder {
|
||||
return httpResponse;
|
||||
} else {
|
||||
// Response body will follow in a series of Data Frames
|
||||
messageMap.put(new Integer(streamID), httpResponse);
|
||||
messageMap.put(streamID, httpResponse);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// If a client receives a SYN_REPLY without valid status and version headers
|
||||
@ -190,7 +190,7 @@ public class SpdyHttpDecoder extends OneToOneDecoder {
|
||||
} else if (msg instanceof SpdyHeadersFrame) {
|
||||
|
||||
SpdyHeadersFrame spdyHeadersFrame = (SpdyHeadersFrame) msg;
|
||||
Integer streamID = new Integer(spdyHeadersFrame.getStreamId());
|
||||
Integer streamID = spdyHeadersFrame.getStreamId();
|
||||
HttpMessage httpMessage = messageMap.get(streamID);
|
||||
|
||||
// If message is not in map discard HEADERS frame.
|
||||
@ -206,7 +206,7 @@ public class SpdyHttpDecoder extends OneToOneDecoder {
|
||||
} else if (msg instanceof SpdyDataFrame) {
|
||||
|
||||
SpdyDataFrame spdyDataFrame = (SpdyDataFrame) msg;
|
||||
Integer streamID = new Integer(spdyDataFrame.getStreamId());
|
||||
Integer streamID = spdyDataFrame.getStreamId();
|
||||
HttpMessage httpMessage = messageMap.get(streamID);
|
||||
|
||||
// If message is not in map discard Data Frame.
|
||||
@ -239,7 +239,7 @@ public class SpdyHttpDecoder extends OneToOneDecoder {
|
||||
} else if (msg instanceof SpdyRstStreamFrame) {
|
||||
|
||||
SpdyRstStreamFrame spdyRstStreamFrame = (SpdyRstStreamFrame) msg;
|
||||
Integer streamID = new Integer(spdyRstStreamFrame.getStreamId());
|
||||
Integer streamID = spdyRstStreamFrame.getStreamId();
|
||||
messageMap.remove(streamID);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ final class SpdySession {
|
||||
}
|
||||
|
||||
boolean isActiveStream(int streamID) {
|
||||
return activeStreams.containsKey(new Integer(streamID));
|
||||
return activeStreams.containsKey(streamID);
|
||||
}
|
||||
|
||||
// Stream-IDs should be iterated in priority order
|
||||
@ -59,13 +59,13 @@ final class SpdySession {
|
||||
int sendWindowSize, int receiveWindowSize) {
|
||||
if (!remoteSideClosed || !localSideClosed) {
|
||||
activeStreams.put(
|
||||
new Integer(streamID),
|
||||
streamID,
|
||||
new StreamState(priority, remoteSideClosed, localSideClosed, sendWindowSize, receiveWindowSize));
|
||||
}
|
||||
}
|
||||
|
||||
void removeStream(int streamID) {
|
||||
Integer StreamID = new Integer(streamID);
|
||||
Integer StreamID = streamID;
|
||||
StreamState state = activeStreams.get(StreamID);
|
||||
activeStreams.remove(StreamID);
|
||||
if (state != null) {
|
||||
@ -78,12 +78,12 @@ final class SpdySession {
|
||||
}
|
||||
|
||||
boolean isRemoteSideClosed(int streamID) {
|
||||
StreamState state = activeStreams.get(new Integer(streamID));
|
||||
StreamState state = activeStreams.get(streamID);
|
||||
return state == null || state.isRemoteSideClosed();
|
||||
}
|
||||
|
||||
void closeRemoteSide(int streamID) {
|
||||
Integer StreamID = new Integer(streamID);
|
||||
Integer StreamID = streamID;
|
||||
StreamState state = activeStreams.get(StreamID);
|
||||
if (state != null) {
|
||||
state.closeRemoteSide();
|
||||
@ -94,12 +94,12 @@ final class SpdySession {
|
||||
}
|
||||
|
||||
boolean isLocalSideClosed(int streamID) {
|
||||
StreamState state = activeStreams.get(new Integer(streamID));
|
||||
StreamState state = activeStreams.get(streamID);
|
||||
return state == null || state.isLocalSideClosed();
|
||||
}
|
||||
|
||||
void closeLocalSide(int streamID) {
|
||||
Integer StreamID = new Integer(streamID);
|
||||
Integer StreamID = streamID;
|
||||
StreamState state = activeStreams.get(StreamID);
|
||||
if (state != null) {
|
||||
state.closeLocalSide();
|
||||
@ -115,29 +115,29 @@ final class SpdySession {
|
||||
*/
|
||||
|
||||
boolean hasReceivedReply(int streamID) {
|
||||
StreamState state = activeStreams.get(new Integer(streamID));
|
||||
StreamState state = activeStreams.get(streamID);
|
||||
return state != null && state.hasReceivedReply();
|
||||
}
|
||||
|
||||
void receivedReply(int streamID) {
|
||||
StreamState state = activeStreams.get(new Integer(streamID));
|
||||
StreamState state = activeStreams.get(streamID);
|
||||
if (state != null) {
|
||||
state.receivedReply();
|
||||
}
|
||||
}
|
||||
|
||||
int getSendWindowSize(int streamID) {
|
||||
StreamState state = activeStreams.get(new Integer(streamID));
|
||||
StreamState state = activeStreams.get(streamID);
|
||||
return state != null ? state.getSendWindowSize() : -1;
|
||||
}
|
||||
|
||||
int updateSendWindowSize(int streamID, int deltaWindowSize) {
|
||||
StreamState state = activeStreams.get(new Integer(streamID));
|
||||
StreamState state = activeStreams.get(streamID);
|
||||
return state != null ? state.updateSendWindowSize(deltaWindowSize) : -1;
|
||||
}
|
||||
|
||||
int updateReceiveWindowSize(int streamID, int deltaWindowSize) {
|
||||
StreamState state = activeStreams.get(new Integer(streamID));
|
||||
StreamState state = activeStreams.get(streamID);
|
||||
if (deltaWindowSize > 0) {
|
||||
state.setReceiveWindowSizeLowerBound(0);
|
||||
}
|
||||
@ -145,7 +145,7 @@ final class SpdySession {
|
||||
}
|
||||
|
||||
int getReceiveWindowSizeLowerBound(int streamID) {
|
||||
StreamState state = activeStreams.get(new Integer(streamID));
|
||||
StreamState state = activeStreams.get(streamID);
|
||||
return state != null ? state.getReceiveWindowSizeLowerBound() : 0;
|
||||
}
|
||||
|
||||
@ -159,17 +159,17 @@ final class SpdySession {
|
||||
}
|
||||
|
||||
boolean putPendingWrite(int streamID, MessageEvent evt) {
|
||||
StreamState state = activeStreams.get(new Integer(streamID));
|
||||
StreamState state = activeStreams.get(streamID);
|
||||
return state != null && state.putPendingWrite(evt);
|
||||
}
|
||||
|
||||
MessageEvent getPendingWrite(int streamID) {
|
||||
StreamState state = activeStreams.get(new Integer(streamID));
|
||||
StreamState state = activeStreams.get(streamID);
|
||||
return state != null ? state.getPendingWrite() : null;
|
||||
}
|
||||
|
||||
MessageEvent removePendingWrite(int streamID) {
|
||||
StreamState state = activeStreams.get(new Integer(streamID));
|
||||
StreamState state = activeStreams.get(streamID);
|
||||
return state != null ? state.removePendingWrite() : null;
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,7 @@ public abstract class CIDR implements Comparable<CIDR> {
|
||||
try {
|
||||
res = Integer.decode(intstr);
|
||||
} catch (Exception e) {
|
||||
res = new Integer(def);
|
||||
res = def;
|
||||
}
|
||||
return res.intValue();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user