Steven Pearce created SUREFIRE-2068:
---------------------------------------

             Summary: 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
         Attachments: Archive.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 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