Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-1085

NumberFormatException when parsing junit report

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Duplicate
    • Component/s: junit-plugin
    • Labels:
      None
    • Environment:
      Platform: All, OS: All
    • Similar Issues:

      Description

      The JUnit task has issues reading the JUnit test report from one of my
      components.

      The exception is as follows:

      hudson.util.IOException2: Failed to
      read /data/hudson_builds/jobs/Site_Build/workspace/trunk/systemtest/dbsyncupdate
      /target/surefire-reports/TEST-au.com.east.st.DbsyncUpdateSystemTest.xml
      at hudson.tasks.junit.TestResult.parse(TestResult.java:125)
      at hudson.tasks.junit.TestResult.parse(TestResult.java:92)
      at hudson.tasks.junit.TestResult.<init>(TestResult.java:69)
      at hudson.tasks.junit.JUnitResultArchiver$1.invoke
      (JUnitResultArchiver.java:67)
      at hudson.tasks.junit.JUnitResultArchiver$1.invoke
      (JUnitResultArchiver.java:52)
      at hudson.FilePath.act(FilePath.java:291)
      at hudson.tasks.junit.JUnitResultArchiver.perform
      (JUnitResultArchiver.java:52)
      at hudson.model.Build$RunnerImpl.performAllBuildStep(Build.java:150)
      at hudson.model.Build$RunnerImpl.post2(Build.java:137)
      at hudson.model.AbstractBuild$AbstractRunner.post
      (AbstractBuild.java:254)
      at hudson.model.Run.run(Run.java:667)
      at hudson.model.Build.run(Build.java:102)
      at hudson.model.ResourceController.execute(ResourceController.java:70)
      at hudson.model.Executor.run(Executor.java:64)
      Caused by: java.lang.NumberFormatException: For input string: "2,297.255"
      at sun.misc.FloatingDecimal.readJavaFormatString
      (FloatingDecimal.java:1224)
      at java.lang.Float.parseFloat(Float.java:394)
      at hudson.tasks.junit.CaseResult.parseTime(CaseResult.java:36)
      at hudson.tasks.junit.CaseResult.<init>(CaseResult.java:31)
      at hudson.tasks.junit.SuiteResult.<init>(SuiteResult.java:65)
      at hudson.tasks.junit.TestResult.parse(TestResult.java:121)
      ... 13 more

      Inspecting the offending Junit report I can see the following:

      <testsuite errors="0" skipped="0" tests="6" time="3,000.262" failures="0"
      name="au.com.east.st.DbsyncUpdateSystemTest">

      and:
      <testcase time="2,297.255" name="testTCDS009"/>

      Looking at the code for the parseTime() method in CaseResult it is only using
      Float.parseFloat(). This doesn't support floats formatted with comma
      separators. The class should be using the DecimalFormat class to parse the
      number instead.

      The same can be said of the CaseResult(SuiteResult parent, Element testCase,
      String testCaseName) constructor.

        Attachments

          Activity

          Hide
          kohsuke Kohsuke Kawaguchi added a comment -

          Fixed in 1.161.

          Given the typical data format in XML, I wonder if this should be rather filed as
          a bug in Ant, though.

          Show
          kohsuke Kohsuke Kawaguchi added a comment - Fixed in 1.161. Given the typical data format in XML, I wonder if this should be rather filed as a bug in Ant, though.
          Hide
          mirumpf Michael Rumpf added a comment - - edited

          Jenkins 1.651.1
          JUnit Plugin: 1.12

          18:37:42 [JENKINS] Recording test results
          18:37:45 java.io.IOException: Failed to read D:\export\xxx\jenkins-slave-xxx2\workspace\xxx-xxx-5.14\xxx-enduser\citest\target\surefire-reports\TEST-internal_xxx_xxx_status.json.xml
          18:37:45 	at hudson.tasks.junit.TestResult.parse(TestResult.java:306)
          18:37:45 	at hudson.tasks.junit.TestResult.parsePossiblyEmpty(TestResult.java:244)
          18:37:45 	at hudson.tasks.junit.TestResult.parse(TestResult.java:213)
          18:37:45 	at hudson.maven.reporters.SurefireArchiver.postExecute(SurefireArchiver.java:148)
          18:37:45 	at hudson.maven.Maven3Builder$MavenExecutionListener.recordMojoEnded(Maven3Builder.java:634)
          18:37:45 	at hudson.maven.Maven3Builder$MavenExecutionListener.mojoSucceeded(Maven3Builder.java:615)
          18:37:45 	at hudson.maven.Maven3Builder$JenkinsEventSpy.onEvent(Maven3Builder.java:308)
          18:37:45 	at org.apache.maven.eventspy.internal.EventSpyDispatcher.onEvent(EventSpyDispatcher.java:104)
          18:37:45 	at org.apache.maven.eventspy.internal.EventSpyExecutionListener.mojoSucceeded(EventSpyExecutionListener.java:131)
          18:37:45 	at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:87)
          18:37:45 	at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:42)
          18:37:45 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)
          18:37:45 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
          18:37:45 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
          18:37:45 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
          18:37:45 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
          18:37:45 	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
          18:37:45 	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
          18:37:45 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
          18:37:45 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
          18:37:45 	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
          18:37:45 	at org.jvnet.hudson.maven3.launcher.Maven32Launcher.main(Maven32Launcher.java:132)
          18:37:45 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          18:37:45 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          18:37:45 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          18:37:45 	at java.lang.reflect.Method.invoke(Method.java:498)
          18:37:45 	at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
          18:37:45 	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
          18:37:45 	at jenkins.maven3.agent.Maven32Main.launch(Maven32Main.java:186)
          18:37:45 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          18:37:45 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          18:37:45 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          18:37:45 	at java.lang.reflect.Method.invoke(Method.java:498)
          18:37:45 	at hudson.maven.Maven3Builder.call(Maven3Builder.java:136)
          18:37:45 	at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
          18:37:45 	at hudson.remoting.UserRequest.perform(UserRequest.java:120)
          18:37:45 	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
          18:37:45 	at hudson.remoting.Request$2.run(Request.java:326)
          18:37:45 	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
          18:37:45 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          18:37:45 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          18:37:45 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          18:37:45 	at java.lang.Thread.run(Thread.java:745)
          18:37:45 Caused by: java.lang.NumberFormatException: For input string: "1,306.161"
          18:37:45 	at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
          18:37:45 	at sun.misc.FloatingDecimal.parseFloat(FloatingDecimal.java:122)
          18:37:45 	at java.lang.Float.parseFloat(Float.java:451)
          18:37:45 	at hudson.tasks.junit.SuiteResult.<init>(SuiteResult.java:170)
          18:37:45 	at hudson.tasks.junit.SuiteResult.parseSuite(SuiteResult.java:144)
          18:37:45 	at hudson.tasks.junit.SuiteResult.parse(SuiteResult.java:129)
          18:37:45 	at hudson.tasks.junit.TestResult.parse(TestResult.java:301)
          18:37:45 	... 42 more
          

          The parseFloat() cannot deal with US thousand separator ",".
          Is this a regression of an almost 10 year old bug?

          Show
          mirumpf Michael Rumpf added a comment - - edited Jenkins 1.651.1 JUnit Plugin: 1.12 18:37:42 [JENKINS] Recording test results 18:37:45 java.io.IOException: Failed to read D:\export\xxx\jenkins-slave-xxx2\workspace\xxx-xxx-5.14\xxx-enduser\citest\target\surefire-reports\TEST-internal_xxx_xxx_status.json.xml 18:37:45 at hudson.tasks.junit.TestResult.parse(TestResult.java:306) 18:37:45 at hudson.tasks.junit.TestResult.parsePossiblyEmpty(TestResult.java:244) 18:37:45 at hudson.tasks.junit.TestResult.parse(TestResult.java:213) 18:37:45 at hudson.maven.reporters.SurefireArchiver.postExecute(SurefireArchiver.java:148) 18:37:45 at hudson.maven.Maven3Builder$MavenExecutionListener.recordMojoEnded(Maven3Builder.java:634) 18:37:45 at hudson.maven.Maven3Builder$MavenExecutionListener.mojoSucceeded(Maven3Builder.java:615) 18:37:45 at hudson.maven.Maven3Builder$JenkinsEventSpy.onEvent(Maven3Builder.java:308) 18:37:45 at org.apache.maven.eventspy.internal.EventSpyDispatcher.onEvent(EventSpyDispatcher.java:104) 18:37:45 at org.apache.maven.eventspy.internal.EventSpyExecutionListener.mojoSucceeded(EventSpyExecutionListener.java:131) 18:37:45 at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:87) 18:37:45 at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:42) 18:37:45 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215) 18:37:45 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 18:37:45 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 18:37:45 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) 18:37:45 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 18:37:45 at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) 18:37:45 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) 18:37:45 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) 18:37:45 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) 18:37:45 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) 18:37:45 at org.jvnet.hudson.maven3.launcher.Maven32Launcher.main(Maven32Launcher.java:132) 18:37:45 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 18:37:45 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 18:37:45 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 18:37:45 at java.lang.reflect.Method.invoke(Method.java:498) 18:37:45 at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330) 18:37:45 at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238) 18:37:45 at jenkins.maven3.agent.Maven32Main.launch(Maven32Main.java:186) 18:37:45 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 18:37:45 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 18:37:45 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 18:37:45 at java.lang.reflect.Method.invoke(Method.java:498) 18:37:45 at hudson.maven.Maven3Builder.call(Maven3Builder.java:136) 18:37:45 at hudson.maven.Maven3Builder.call(Maven3Builder.java:71) 18:37:45 at hudson.remoting.UserRequest.perform(UserRequest.java:120) 18:37:45 at hudson.remoting.UserRequest.perform(UserRequest.java:48) 18:37:45 at hudson.remoting.Request$2.run(Request.java:326) 18:37:45 at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) 18:37:45 at java.util.concurrent.FutureTask.run(FutureTask.java:266) 18:37:45 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 18:37:45 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 18:37:45 at java.lang. Thread .run( Thread .java:745) 18:37:45 Caused by: java.lang.NumberFormatException: For input string: "1,306.161" 18:37:45 at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043) 18:37:45 at sun.misc.FloatingDecimal.parseFloat(FloatingDecimal.java:122) 18:37:45 at java.lang. Float .parseFloat( Float .java:451) 18:37:45 at hudson.tasks.junit.SuiteResult.<init>(SuiteResult.java:170) 18:37:45 at hudson.tasks.junit.SuiteResult.parseSuite(SuiteResult.java:144) 18:37:45 at hudson.tasks.junit.SuiteResult.parse(SuiteResult.java:129) 18:37:45 at hudson.tasks.junit.TestResult.parse(TestResult.java:301) 18:37:45 ... 42 more The parseFloat() cannot deal with US thousand separator ",". Is this a regression of an almost 10 year old bug?
          Hide
          mirumpf Michael Rumpf added a comment -

          Duplicate of JENKINS-34407

          Show
          mirumpf Michael Rumpf added a comment - Duplicate of JENKINS-34407

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            jchharris jchharris
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: