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
protected void encode(
ChannelHandlerContext ctx,
ByteBuf msg, ByteBuf out) throws Exception {
protected void encode(ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out) throws Exception {
int length = (lengthIncludesLengthFieldLength?
msg.readableBytes() + lengthFieldLength : msg.readableBytes()) +
lengthAdjustment;
int length = msg.readableBytes() + lengthAdjustment;
if (lengthIncludesLengthFieldLength) {
length += lengthFieldLength;
}
if (length < 0) {
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,
* 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.Test;
import static io.netty.buffer.Unpooled.copiedBuffer;
import static io.netty.buffer.Unpooled.wrappedBuffer;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static io.netty.buffer.Unpooled.*;
import static org.hamcrest.core.Is.*;
import static org.junit.Assert.*;
public class LengthFieldPrependerTest {