Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-2068

System.out.println() causes BufferOverflow

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 3.0.0-M6
    • None
    • None

    Description

      Using the SUREFIRE-1614 minimal project as a starting point I've added the line

      System.out.println();
      

      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

      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)
      

      Attachments

        1. surefire-buffer-overflow.zip
          61 kB
          Steven Pearce
        2. screenshot-1.png
          72 kB
          Zoltan Meze

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Stexxen Steven Pearce
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: