Readability / Fix inception year
This commit is contained in:
parent
3a5aa12000
commit
e58af1bc94
@ -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(
|
||||||
|
@ -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 {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user