You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/04/11 20:22:34 UTC

[GitHub] [maven-surefire] zoltanmeze commented on pull request #518: [SUREFIRE-2058] - Corrupted STDOUT by directly writing to native stream in forked JVM 1 with UTF-8 console logging

zoltanmeze commented on PR #518:
URL: https://github.com/apache/maven-surefire/pull/518#issuecomment-1095528603

   I believe it it a different issue, not throwing any `BufferOverflowException`.
   
   `CharsetDecoder#decode` in [decodeString call (here)](https://github.com/apache/maven-surefire/blob/master/surefire-api/src/main/java/org/apache/maven/surefire/api/stream/AbstractStreamDecoder.java#L322) results in overflow when there is not enough space left in the output char buffer. And output buffer is not cleared because the `!output.hasRemaining()` condition. Clearing after each chunk ensures underflow in `decodeString`, so it has always enough space to write decoded string into the the output buffer.
   
   You can verify this with the two included unit tests. Test method naming is probably not the best, in the first it doesn't needs to be a new line character after a 2-bytes encoded character, it can be anything else.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org