Uploaded image for project: 'Gradle'
  1. Gradle
  2. GRADLE-1513

Concurrency Bug With JUnit Test Listener

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: 1.0-milestone-1
    • Fix Version/s: 1.3-rc-1

      Description

      Looks like JUnitXmlReportGenerator is using a StringBuilder instead of a StringBuffer at around line 59, which is causing it to fail in surprising (and unhelpfully messaged) ways if multiple concurrent JUnit tests write to System.out. Changing back to a StringBuffer will solve this problem.

      org.gradle.listener.ListenerNotificationException: Failed to notify test result processor.
      at org.gradle.messaging.dispatch.BroadcastDispatch.dispatch(BroadcastDispatch.java:97)
      at org.gradle.messaging.dispatch.BroadcastDispatch.dispatch(BroadcastDispatch.java:32)
      at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:75)
      at $Proxy5.output(Unknown Source)
      at org.gradle.api.internal.tasks.testing.processors.CaptureTestOutputTestResultProcessor$1.onOutput(CaptureTestOutputTestResultProcessor.java:45)
      at org.gradle.logging.internal.DefaultStandardOutputRedirector$WriteAction.execute(DefaultStandardOutputRedirector.java:83)
      at org.gradle.logging.internal.DefaultStandardOutputRedirector$WriteAction.execute(DefaultStandardOutputRedirector.java:79)
      at org.gradle.util.LineBufferingOutputStream$StringOutput.write(LineBufferingOutputStream.java:147)
      at org.gradle.util.LineBufferingOutputStream.flush(LineBufferingOutputStream.java:120)
      at org.gradle.util.LineBufferingOutputStream.write(LineBufferingOutputStream.java:92)
      at java.io.OutputStream.write(OutputStream.java:116)
      at java.io.PrintStream.write(PrintStream.java:480)
      at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
      at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
      at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:104)
      at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:185)
      at java.io.PrintStream.newLine(PrintStream.java:546)
      at java.io.PrintStream.println(PrintStream.java:807)
      at org.gradle.util.LinePerThreadBufferingOutputStream.println(LinePerThreadBufferingOutputStream.java:205)
      at test.TestBase.assertPutOut(TestBase.java:62)
      at test.TestBase.assertPutzOut(TestBase.java:49)
      at test._001_BinaryIntegerArithmetic$1.test(_001_BinaryIntegerArithmetic.java:17)
      at test.TestBase$ParallelTest.call(TestBase.java:80)
      at test.TestBase$ParallelTest.call(TestBase.java:76)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      at java.lang.Thread.run(Thread.java:722)
      Caused by: java.lang.ArrayIndexOutOfBoundsException
      at java.lang.String.getChars(String.java:863)
      at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:416)
      at java.lang.StringBuilder.append(StringBuilder.java:132)
      at org.gradle.api.internal.tasks.testing.junit.JUnitXmlReportGenerator.output(JUnitXmlReportGenerator.java:59)
      at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:613)
      at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
      at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
      at org.gradle.messaging.dispatch.BroadcastDispatch.dispatch(BroadcastDispatch.java:88)

        Attachments

          Activity

            People

            Assignee:
            pniederw Peter Niederwieser
            Reporter:
            robertfischer Robert Fischer
            Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: