ReplayingDecoder should not throw an IllegalStateException even if a decoder implementation returns null when state transition occurred at least.
This commit is contained in:
parent
7860e999a7
commit
4f391f5bbc
@ -371,11 +371,11 @@ public abstract class ReplayingDecoder<T extends Enum<T>>
|
||||
try {
|
||||
result = decode(context, channel, replayable, state);
|
||||
if (result == null) {
|
||||
if (oldReaderIndex == cumulation.readerIndex()) {
|
||||
if (oldReaderIndex == cumulation.readerIndex() && oldState == state) {
|
||||
throw new IllegalStateException(
|
||||
"null cannot be returned if no data is consumed.");
|
||||
"null cannot be returned if no data is consumed and state didn't change.");
|
||||
} else {
|
||||
// Previous data has been discarded.
|
||||
// Previous data has been discarded or caused state transition.
|
||||
// Probably it is reading on.
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user