Removes unneeded boxing of integers
This is the first in a number of commits that fixes static analysis problems Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
This commit is contained in:
parent
e0a88a0f15
commit
d206ef6d15
@ -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);
|
||||
}
|
||||
|
@ -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