Null Pointer Exception parsing JUnit results

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      Hi,
      first of all thanks for the very good job you are making: your tool is really
      grateful.
      I think I found a bug related to Junit test result parsing.

      In same cases we are getting a:

      FATAL: Failed to read
      /home/dstk110/build/hudson/jobs/DSTK-All-Linux-release/workspace/dstk/report/xml-out/TEST-com.primeur.dstk.datamanager.test.DSTSPTest.xml
      hudson.util.IOException2: Failed to read
      /home/dstk110/build/hudson/jobs/DSTK-All-Linux-release/workspace/dstk/report/xml-out/TEST-com.primeur.dstk.datamanager.test.DSTSPTest.xml
      at hudson.tasks.junit.TestResult.parse(TestResult.java:128)
      at hudson.tasks.junit.TestResult.parse(TestResult.java:95)
      at hudson.tasks.junit.TestResult.<init>(TestResult.java:72)
      at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:62)
      at hudson.tasks.junit.JUnitResultArchiver$1.invoke(JUnitResultArchiver.java:51)
      at hudson.FilePath.act(FilePath.java:301)
      at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:51)
      at
      hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:273)
      at
      hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:261)
      at hudson.model.Build$RunnerImpl.post2(Build.java:136)
      at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:246)
      at hudson.model.Run.run(Run.java:677)
      at hudson.model.Build.run(Build.java:101)
      at hudson.model.ResourceController.execute(ResourceController.java:70)
      at hudson.model.Executor.run(Executor.java:65)
      Caused by: java.lang.NullPointerException
      at hudson.tasks.junit.CaseResult.parseTime(CaseResult.java:47)
      at hudson.tasks.junit.CaseResult.<init>(CaseResult.java:34)
      at hudson.tasks.junit.CaseResult.<init>(CaseResult.java:42)
      at hudson.tasks.junit.SuiteResult.<init>(SuiteResult.java:69)
      at hudson.tasks.junit.TestResult.parse(TestResult.java:124)
      ... 14 more

      After having had a look at the source code :

      http://fisheye5.cenqua.com/browse/hudson/hudson/main/core/src/main/java/hudson/tasks/junit/CaseResult.java#r1.13

      at line 48 there is a check if(time=!null).
      In some of our test, we have seen that the time attribute is not set.

      Is it possible to move the line

      time = time.replace(",","");

      inside the check so that if the time attribute is not present it does not break
      the build?

      Thanks in advance,
      Fulvio

            Assignee:
            Unassigned
            Reporter:
            f_cavarretta
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: