Cleanup failIfNecessary, fix comment.

This commit is contained in:
Aaron Riekenberg 2011-08-20 20:11:28 -05:00
parent f474fc609a
commit c2417c253c

View File

@ -374,18 +374,19 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder {
long tooLongFrameLength = this.tooLongFrameLength;
this.tooLongFrameLength = 0;
discardingTooLongFrame = false;
if (!failImmediatelyOnTooLongFrame)
if ((!failImmediatelyOnTooLongFrame) ||
(failImmediatelyOnTooLongFrame && firstDetectionOfTooLongFrame))
{
fail(ctx, tooLongFrameLength);
}
} else {
// Keep discarding.
// Keep discarding and notify handlers if necessary.
if (failImmediatelyOnTooLongFrame && firstDetectionOfTooLongFrame)
{
fail(ctx, this.tooLongFrameLength);
}
}
if (firstDetectionOfTooLongFrame && failImmediatelyOnTooLongFrame)
{
fail(ctx, tooLongFrameLength);
}
}
/**
@ -414,10 +415,10 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder {
*
* @param failImmediatelyOnTooLongFrame If false (the default) a {@link TooLongFrameException}
* is thrown if the length of the frame exceeds maxFrameLength,
* after the delimiter has been read.
* after the entire frame has been read.
* If true a {@link TooLongFrameException} is thrown immediately
* when the length of the frame exceeds maxFrameLength,
* regardless of whether a delimiter has been found yet.
* regardless of whether the entire frame has been read.
*/
public LengthFieldBasedFrameDecoder setFailImmediatelyOnTooLongFrame(
boolean failImmediatelyOnTooLongFrame)