Skip to content

Commit 494743e

Browse files
committed
[SUREFIRE-2058] Flip and clear output char buffer after each chunk read
Overflow can happen even when output buffer has still some remaining space left
1 parent de578c0 commit 494743e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

surefire-api/src/main/java/org/apache/maven/surefire/api/stream/AbstractStreamDecoder.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,8 @@ private String readString( @Nonnull final Memento memento, @Nonnegative final in
326326
}
327327
while ( isLastChunk && bytesToDecode > 0 && output.hasRemaining() );
328328

329-
if ( isLastChunk || !output.hasRemaining() )
330-
{
331-
strings.add( ( (Buffer) output ).flip().toString() );
332-
( (Buffer) output ).clear();
333-
}
329+
strings.add( ( (Buffer) output ).flip().toString() );
330+
( (Buffer) output ).clear();
334331
}
335332

336333
memento.getDecoder().reset();

0 commit comments

Comments
 (0)