[ 
https://issues.apache.org/jira/browse/SUREFIRE-2068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17521661#comment-17521661
 ] 

Jan Waś commented on SUREFIRE-2068:
-----------------------------------

I'm seeing this in a module that uses TestNG 6.10, when trying to upgrade to 
3.0.0-M6 in [the Trino project:|https://github.com/trinodb/trino]

 
{noformat}
Caused by: java.nio.BufferOverflowException
        at java.base/java.nio.Buffer.nextPutIndex(Buffer.java:666)
        at java.base/java.nio.HeapByteBuffer.put(HeapByteBuffer.java:200)
        at 
org.apache.maven.surefire.api.stream.AbstractStreamEncoder.encodeString(AbstractStreamEncoder.java:127)
        at 
org.apache.maven.surefire.api.stream.AbstractStreamEncoder.encodeStringData(AbstractStreamEncoder.java:171)
        at 
org.apache.maven.surefire.api.stream.AbstractStreamEncoder.encode(AbstractStreamEncoder.java:157)
        at 
org.apache.maven.surefire.booter.spi.EventChannelEncoder.encodeMessage(EventChannelEncoder.java:398)
        at 
org.apache.maven.surefire.booter.spi.EventChannelEncoder.setOutErr(EventChannelEncoder.java:188)
        at 
org.apache.maven.surefire.booter.spi.EventChannelEncoder.testOutput(EventChannelEncoder.java:183)
        at 
org.apache.maven.surefire.api.booter.ForkingRunListener.writeTestOutput(ForkingRunListener.java:113)
        at 
org.apache.maven.surefire.api.booter.ForkingRunListener.writeTestOutput(ForkingRunListener.java:44)
        at 
org.apache.maven.surefire.testng.TestNGReporter.writeTestOutput(TestNGReporter.java:240)
        at 
org.apache.maven.surefire.api.report.ConsoleOutputCapture$ForwardingPrintStream.println(ConsoleOutputCapture.java:144)
        at 
io.trino.execution.TestingPageSourceProvider.<init>(TestingPageSourceProvider.java:41)
        at 
io.trino.execution.TaskTestUtils.createTestingPlanner(TaskTestUtils.java:107)
        at io.trino.execution.TestSqlTask.<init>(TestSqlTask.java:95)
        ... 33 more{noformat}
 

 

> System.out.println() causes BufferOverflow
> ------------------------------------------
>
>                 Key: SUREFIRE-2068
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-2068
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Junit 4.x support, JUnit 5.x support
>    Affects Versions: 3.0.0-M6
>            Reporter: Steven Pearce
>            Priority: Minor
>         Attachments: surefire-buffer-overflow.zip
>
>
> Using the SUREFIRE-1614 minimal project as a starting point I've added the 
> line
> {noformat}
> System.out.println();
> {noformat}
> at line 16 of CustomRunner.class
> I've also updated the dependancies, but it mostly remains the same.
> I've attached the reproducible example
> Executing with `./mvnw -Pjunit5 test` or `./mvnw -Pjunit4 test` both produce 
> the same output.
> Downgrading to 3.0.0-M5 no longer causes the issue.
> This will now trigger the exception
> {noformat}
> java.nio.BufferOverflowException
>       at java.base/java.nio.Buffer.nextPutIndex(Buffer.java:722)
>       at java.base/java.nio.HeapByteBuffer.put(HeapByteBuffer.java:209)
>       at 
> org.apache.maven.surefire.api.stream.AbstractStreamEncoder.encodeString(AbstractStreamEncoder.java:127)
>       at 
> org.apache.maven.surefire.api.stream.AbstractStreamEncoder.encodeStringData(AbstractStreamEncoder.java:171)
>       at 
> org.apache.maven.surefire.api.stream.AbstractStreamEncoder.encode(AbstractStreamEncoder.java:157)
>       at 
> org.apache.maven.surefire.booter.spi.EventChannelEncoder.encodeMessage(EventChannelEncoder.java:398)
>       at 
> org.apache.maven.surefire.booter.spi.EventChannelEncoder.setOutErr(EventChannelEncoder.java:188)
>       at 
> org.apache.maven.surefire.booter.spi.EventChannelEncoder.testOutput(EventChannelEncoder.java:183)
>       at 
> org.apache.maven.surefire.api.booter.ForkingRunListener.writeTestOutput(ForkingRunListener.java:113)
>       at 
> org.apache.maven.surefire.api.booter.ForkingRunListener.writeTestOutput(ForkingRunListener.java:44)
>       at 
> org.apache.maven.surefire.junitplatform.RunListenerAdapter.writeTestOutput(RunListenerAdapter.java:379)
>       at 
> org.apache.maven.surefire.api.report.ConsoleOutputCapture$ForwardingPrintStream.println(ConsoleOutputCapture.java:144)
>       at com.example.demo.CustomRunner.createTestClass(CustomRunner.java:16)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to