Readability / Fix inception year

This commit is contained in:
Trustin Lee 2013-05-17 17:58:34 +09:00
parent 3a5aa12000
commit e58af1bc94
2 changed files with 9 additions and 12 deletions

View File

@ -128,13 +128,12 @@ public class LengthFieldPrepender extends MessageToByteEncoder<ByteBuf> {
} }
@Override @Override
protected void encode( protected void encode(ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out) throws Exception {
ChannelHandlerContext ctx,
ByteBuf msg, ByteBuf out) throws Exception {
int length = (lengthIncludesLengthFieldLength? int length = msg.readableBytes() + lengthAdjustment;
msg.readableBytes() + lengthFieldLength : msg.readableBytes()) + if (lengthIncludesLengthFieldLength) {
lengthAdjustment; length += lengthFieldLength;
}
if (length < 0) { if (length < 0) {
throw new IllegalArgumentException( throw new IllegalArgumentException(

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012 The Netty Project * Copyright 2013 The Netty Project
* *
* The Netty Project licenses this file to you under the Apache License, * The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance * version 2.0 (the "License"); you may not use this file except in compliance
@ -23,11 +23,9 @@ import io.netty.util.CharsetUtil;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import static io.netty.buffer.Unpooled.copiedBuffer; import static io.netty.buffer.Unpooled.*;
import static io.netty.buffer.Unpooled.wrappedBuffer; import static org.hamcrest.core.Is.*;
import static org.hamcrest.core.Is.is; import static org.junit.Assert.*;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
public class LengthFieldPrependerTest { public class LengthFieldPrependerTest {