Inline redundant local variables.
This commit is contained in:
parent
ab61090572
commit
b6dc30b37b
@ -804,8 +804,7 @@ public class ChannelBuffers {
|
||||
}
|
||||
|
||||
private static ChannelBuffer copiedBuffer(ByteOrder endianness, CharBuffer buffer, Charset charset) {
|
||||
CharBuffer src = buffer;
|
||||
ByteBuffer dst = ChannelBuffers.encodeString(src, charset);
|
||||
ByteBuffer dst = ChannelBuffers.encodeString(buffer, charset);
|
||||
ChannelBuffer result = wrappedBuffer(endianness, dst.array());
|
||||
result.writerIndex(dst.remaining());
|
||||
return result;
|
||||
|
@ -59,8 +59,7 @@ final class CombinedIterator<E> implements Iterator<E> {
|
||||
@Override
|
||||
public E next() {
|
||||
try {
|
||||
E e = currentIterator.next();
|
||||
return e;
|
||||
return currentIterator.next();
|
||||
} catch (NoSuchElementException e) {
|
||||
if (currentIterator == i1) {
|
||||
currentIterator = i2;
|
||||
|
@ -252,9 +252,7 @@ public class HttpTunnelMessageUtils {
|
||||
}
|
||||
|
||||
public static HttpResponse createTunnelCloseResponse() {
|
||||
HttpResponse response =
|
||||
createResponseTemplate(HttpResponseStatus.RESET_CONTENT, null);
|
||||
return response;
|
||||
return createResponseTemplate(HttpResponseStatus.RESET_CONTENT, null);
|
||||
}
|
||||
|
||||
public static boolean isTunnelCloseResponse(HttpResponse response) {
|
||||
|
@ -143,9 +143,7 @@ public class MixedAttribute implements Attribute {
|
||||
if (buffer.readableBytes() > limitSize) {
|
||||
if (attribute instanceof MemoryAttribute) {
|
||||
// change to Disk
|
||||
DiskAttribute diskAttribute = new DiskAttribute(attribute
|
||||
.getName());
|
||||
attribute = diskAttribute;
|
||||
attribute = new DiskAttribute(attribute.getName());
|
||||
}
|
||||
}
|
||||
attribute.setContent(buffer);
|
||||
@ -156,9 +154,7 @@ public class MixedAttribute implements Attribute {
|
||||
if (file.length() > limitSize) {
|
||||
if (attribute instanceof MemoryAttribute) {
|
||||
// change to Disk
|
||||
DiskAttribute diskAttribute = new DiskAttribute(attribute
|
||||
.getName());
|
||||
attribute = diskAttribute;
|
||||
attribute = new DiskAttribute(attribute.getName());
|
||||
}
|
||||
}
|
||||
attribute.setContent(file);
|
||||
@ -168,9 +164,7 @@ public class MixedAttribute implements Attribute {
|
||||
public void setContent(InputStream inputStream) throws IOException {
|
||||
if (attribute instanceof MemoryAttribute) {
|
||||
// change to Disk even if we don't know the size
|
||||
DiskAttribute diskAttribute = new DiskAttribute(attribute
|
||||
.getName());
|
||||
attribute = diskAttribute;
|
||||
attribute = new DiskAttribute(attribute.getName());
|
||||
}
|
||||
attribute.setContent(inputStream);
|
||||
}
|
||||
|
@ -147,12 +147,11 @@ public class MixedFileUpload implements FileUpload {
|
||||
if (buffer.readableBytes() > limitSize) {
|
||||
if (fileUpload instanceof MemoryFileUpload) {
|
||||
// change to Disk
|
||||
DiskFileUpload diskFileUpload = new DiskFileUpload(fileUpload
|
||||
fileUpload = new DiskFileUpload(fileUpload
|
||||
.getName(), fileUpload.getFilename(), fileUpload
|
||||
.getContentType(), fileUpload
|
||||
.getContentTransferEncoding(), fileUpload.getCharset(),
|
||||
definedSize);
|
||||
fileUpload = diskFileUpload;
|
||||
}
|
||||
}
|
||||
fileUpload.setContent(buffer);
|
||||
@ -163,12 +162,11 @@ public class MixedFileUpload implements FileUpload {
|
||||
if (file.length() > limitSize) {
|
||||
if (fileUpload instanceof MemoryFileUpload) {
|
||||
// change to Disk
|
||||
DiskFileUpload diskFileUpload = new DiskFileUpload(fileUpload
|
||||
fileUpload = new DiskFileUpload(fileUpload
|
||||
.getName(), fileUpload.getFilename(), fileUpload
|
||||
.getContentType(), fileUpload
|
||||
.getContentTransferEncoding(), fileUpload.getCharset(),
|
||||
definedSize);
|
||||
fileUpload = diskFileUpload;
|
||||
}
|
||||
}
|
||||
fileUpload.setContent(file);
|
||||
@ -178,12 +176,11 @@ public class MixedFileUpload implements FileUpload {
|
||||
public void setContent(InputStream inputStream) throws IOException {
|
||||
if (fileUpload instanceof MemoryFileUpload) {
|
||||
// change to Disk
|
||||
DiskFileUpload diskFileUpload = new DiskFileUpload(fileUpload
|
||||
fileUpload = new DiskFileUpload(fileUpload
|
||||
.getName(), fileUpload.getFilename(), fileUpload
|
||||
.getContentType(), fileUpload
|
||||
.getContentTransferEncoding(), fileUpload.getCharset(),
|
||||
definedSize);
|
||||
fileUpload = diskFileUpload;
|
||||
}
|
||||
fileUpload.setContent(inputStream);
|
||||
}
|
||||
|
@ -204,7 +204,6 @@ public abstract class WebSocketClientHandshaker {
|
||||
* @return Random number
|
||||
*/
|
||||
protected int createRandomNumber(int min, int max) {
|
||||
int rand = (int) (Math.random() * max + min);
|
||||
return rand;
|
||||
return (int) (Math.random() * max + min);
|
||||
}
|
||||
}
|
||||
|
@ -98,8 +98,7 @@ public class CompatibleObjectEncoder extends OneToOneEncoder {
|
||||
oout.writeObject(msg);
|
||||
oout.flush();
|
||||
|
||||
ChannelBuffer encoded = buffer.readBytes(buffer.readableBytes());
|
||||
return encoded;
|
||||
return buffer.readBytes(buffer.readableBytes());
|
||||
}
|
||||
|
||||
private ChannelBuffer buffer(ChannelHandlerContext ctx) throws Exception {
|
||||
|
@ -66,8 +66,7 @@ public abstract class IpFilteringHandlerImpl implements ChannelUpstreamHandler,
|
||||
{
|
||||
if (listener == null)
|
||||
return null;
|
||||
ChannelFuture result = listener.refused(ctx, e, inetSocketAddress);
|
||||
return result;
|
||||
return listener.refused(ctx, e, inetSocketAddress);
|
||||
}
|
||||
|
||||
protected ChannelFuture handleAllowedChannel(ChannelHandlerContext ctx, ChannelEvent e,
|
||||
@ -75,8 +74,7 @@ public abstract class IpFilteringHandlerImpl implements ChannelUpstreamHandler,
|
||||
{
|
||||
if (listener == null)
|
||||
return null;
|
||||
ChannelFuture result = listener.allowed(ctx, e, inetSocketAddress);
|
||||
return result;
|
||||
return listener.allowed(ctx, e, inetSocketAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -385,8 +385,7 @@ public abstract class AbstractTrafficShapingHandler extends
|
||||
// Time is too short, so just lets continue
|
||||
return 0;
|
||||
}
|
||||
long wait = bytes * 1000 / limit - interval;
|
||||
return wait;
|
||||
return bytes * 1000 / limit - interval;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -519,18 +519,16 @@ final class Deflate {
|
||||
}
|
||||
|
||||
private void send_bits(int value, int length) {
|
||||
int len = length;
|
||||
if (bi_valid > Buf_size - len) {
|
||||
int val = value;
|
||||
if (bi_valid > Buf_size - length) {
|
||||
// bi_buf |= (val << bi_valid);
|
||||
bi_buf |= val << bi_valid & 0xffff;
|
||||
bi_buf |= value << bi_valid & 0xffff;
|
||||
put_short(bi_buf);
|
||||
bi_buf = (short) (val >>> Buf_size - bi_valid);
|
||||
bi_valid += len - Buf_size;
|
||||
bi_buf = (short) (value >>> Buf_size - bi_valid);
|
||||
bi_valid += length - Buf_size;
|
||||
} else {
|
||||
// bi_buf |= (value) << bi_valid;
|
||||
bi_buf |= value << bi_valid & 0xffff;
|
||||
bi_valid += len;
|
||||
bi_valid += length;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,9 +83,8 @@ public class HttpTunnelServerChannelSinkTest {
|
||||
}
|
||||
});
|
||||
|
||||
ChannelFuture virtualFuture1 = Channels.close(channel);
|
||||
ChannelFuture virtualFuture = Channels.close(channel);
|
||||
mockContext.assertIsSatisfied();
|
||||
ChannelFuture virtualFuture = virtualFuture1;
|
||||
realFuture.setSuccess();
|
||||
assertTrue(virtualFuture.isSuccess());
|
||||
}
|
||||
@ -140,8 +139,7 @@ public class HttpTunnelServerChannelSinkTest {
|
||||
}
|
||||
});
|
||||
|
||||
ChannelFuture virtualFuture = Channels.bind(channel, toAddress);
|
||||
return virtualFuture;
|
||||
return Channels.bind(channel, toAddress);
|
||||
}
|
||||
|
||||
private final class ExceptionCatcher extends SimpleChannelUpstreamHandler {
|
||||
|
Loading…
Reference in New Issue
Block a user