Fixed some non-sense code as advised by FindBugs

This commit is contained in:
Trustin Lee 2009-11-03 07:44:06 +00:00
parent ed3500373f
commit 464ea90492
10 changed files with 9 additions and 13 deletions

View File

@ -222,7 +222,7 @@ public class HttpTunnelingServlet extends HttpServlet {
} }
@ChannelPipelineCoverage("one") @ChannelPipelineCoverage("one")
private final class OutboundConnectionHandler extends SimpleChannelUpstreamHandler { private static final class OutboundConnectionHandler extends SimpleChannelUpstreamHandler {
private final ServletOutputStream out; private final ServletOutputStream out;

View File

@ -103,7 +103,7 @@ public class HexDumpProxyInboundHandler extends SimpleChannelUpstreamHandler {
} }
@ChannelPipelineCoverage("one") @ChannelPipelineCoverage("one")
private class OutboundHandler extends SimpleChannelUpstreamHandler { private static class OutboundHandler extends SimpleChannelUpstreamHandler {
private final Channel inboundChannel; private final Channel inboundChannel;

View File

@ -241,7 +241,7 @@ public class ZlibEncoder extends OneToOneEncoder {
if (evt != null) { if (evt != null) {
ctx.sendDownstream(evt); ctx.sendDownstream(evt);
} }
return Channels.succeededFuture(evt.getChannel()); return Channels.succeededFuture(ctx.getChannel());
} }
ChannelBuffer footer; ChannelBuffer footer;

View File

@ -77,7 +77,8 @@ public abstract class HttpContentEncoder extends SimpleChannelHandler {
if (acceptedEncoding == null) { if (acceptedEncoding == null) {
acceptedEncoding = HttpHeaders.Values.IDENTITY; acceptedEncoding = HttpHeaders.Values.IDENTITY;
} }
acceptEncodingQueue.offer(acceptedEncoding); boolean offered = acceptEncodingQueue.offer(acceptedEncoding);
assert offered;
ctx.sendUpstream(e); ctx.sendUpstream(e);
} }

View File

@ -91,7 +91,9 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns
return; return;
} }
queue.offer((MessageEvent) e); boolean offered = queue.offer((MessageEvent) e);
assert offered;
if (ctx.getChannel().isWritable()) { if (ctx.getChannel().isWritable()) {
flush(ctx); flush(ctx);
} }

View File

@ -138,7 +138,6 @@ final class Deflate {
WrapperType wrapperType; WrapperType wrapperType;
private boolean wroteTrailer; private boolean wroteTrailer;
byte data_type; // UNKNOWN, BINARY or ASCII byte data_type; // UNKNOWN, BINARY or ASCII
byte method; // STORED (for zip only) or DEFLATED
int last_flush; // value of flush param for previous deflate call int last_flush; // value of flush param for previous deflate call
int w_size; // LZ77 window size (32K by default) int w_size; // LZ77 window size (32K by default)
int w_bits; // log2(w_size) (8..16) int w_bits; // log2(w_size) (8..16)
@ -1196,7 +1195,7 @@ final class Deflate {
} }
if (match_available != 0) { if (match_available != 0) {
bflush = _tr_tally(0, window[strstart - 1] & 0xff); _tr_tally(0, window[strstart - 1] & 0xff);
match_available = 0; match_available = 0;
} }
flush_block_only(flush == JZlib.Z_FINISH); flush_block_only(flush == JZlib.Z_FINISH);
@ -1363,7 +1362,6 @@ final class Deflate {
//System.out.println("level="+level); //System.out.println("level="+level);
this.strategy = strategy; this.strategy = strategy;
this.method = (byte) method;
return deflateReset(strm); return deflateReset(strm);
} }
@ -1371,7 +1369,6 @@ final class Deflate {
private int deflateReset(ZStream strm) { private int deflateReset(ZStream strm) {
strm.total_in = strm.total_out = 0; strm.total_in = strm.total_out = 0;
strm.msg = null; // strm.msg = null; //
strm.data_type = Z_UNKNOWN;
pending = 0; pending = 0;
pending_out = 0; pending_out = 0;

View File

@ -566,7 +566,6 @@ final class InfBlocks {
write = q; write = q;
r = inflate_flush(z, r); r = inflate_flush(z, r);
q = write; q = write;
m = q < read? read - q - 1 : end - q;
if (read != write) { if (read != write) {
bitb = b; bitb = b;
bitk = k; bitk = k;

View File

@ -409,7 +409,6 @@ final class InfCodes {
s.write = q; s.write = q;
r = s.inflate_flush(z, r); r = s.inflate_flush(z, r);
q = s.write; q = s.write;
m = q < s.read? s.read - q - 1 : s.end - q;
if (s.read != s.write) { if (s.read != s.write) {
s.bitb = b; s.bitb = b;

View File

@ -252,7 +252,6 @@ final class Inflate {
if (z.avail_in == 0) { if (z.avail_in == 0) {
return r; return r;
} }
r = f;
z.avail_in --; z.avail_in --;
z.total_in ++; z.total_in ++;

View File

@ -63,7 +63,6 @@ public final class ZStream {
public String msg; public String msg;
Deflate dstate; Deflate dstate;
Inflate istate; Inflate istate;
int data_type; // best guess about the data type: ascii or binary
long adler; long adler;
int crc32; int crc32;