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

NullPointerException running FitNesse-tests

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Component/s: fitnesse-plugin
    • Labels:
      None
    • Environment:
      jenkins 1.538, FitNesse-plugin 1.9 on RHEL 6 using Oracle JDK 7
    • Similar Issues:

      Description

      Running FitNesse tests results in a build failure with the following stack-trace:

      Starting new Fitnesse instance...
      java.lang.NullPointerException
      at hudson.Launcher.printCommandLine(Launcher.java:634)
      at hudson.Launcher.maskedPrintCommandLine(Launcher.java:656)
      at hudson.Launcher$LocalLauncher.launch(Launcher.java:792)
      at hudson.Launcher$ProcStarter.start(Launcher.java:380)
      at hudson.plugins.fitnesse.FitnesseExecutor.startFitnesse(FitnesseExecutor.java:81)
      at hudson.plugins.fitnesse.FitnesseExecutor.execute(FitnesseExecutor.java:48)
      at hudson.plugins.fitnesse.FitnesseBuilder.perform(FitnesseBuilder.java:270)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
      at hudson.model.Build$BuildExecution.build(Build.java:199)
      at hudson.model.Build$BuildExecution.doRun(Build.java:160)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533)
      at hudson.model.Run.execute(Run.java:1745)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:89)
      at hudson.model.Executor.run(Executor.java:240)

      Configuration is:
      <hudson.plugins.fitnesse.FitnesseBuilder plugin="fitnesse@1.9">
      <options>
      <entry>
      <string>fitnesseJavaOpts</string>
      <string></string>
      </entry>
      <entry>
      <string>fitnesseHttpTimeout</string>
      <string>600000</string>
      </entry>
      <entry>
      <string>fitnessePathToRoot</string>
      <string>root</string>
      </entry>
      <entry>
      <string>fitnesseStart</string>
      <string>True</string>
      </entry>
      <entry>
      <string>fitnesseJdk</string>
      <string>Oracle JDK 7</string>
      </entry>
      <entry>
      <string>fitnessePortLocal</string>
      <string>7999</string>
      </entry>
      <entry>
      <string>fitnesseTargetPage</string>
      <string>TestSuite</string>
      </entry>
      <entry>
      <string>fitnessePathToJar</string>
      <string>fitnesse-standalone.jar</string>
      </entry>
      <entry>
      <string>fitnesseTargetIsSuite</string>
      <string>true</string>
      </entry>
      <entry>
      <string>fitnesseTestTimeout</string>
      <string>600000</string>
      </entry>
      <entry>
      <string>additionalFitnesseOptions</string>
      <string></string>
      </entry>
      <entry>
      <string>fitnesseJavaWorkingDirectory</string>
      <string></string>
      </entry>
      <entry>
      <string>fitnessePathToXmlResultsOut</string>
      <string>fitnesse.xml</string>
      </entry>
      </options>
      </hudson.plugins.fitnesse.FitnesseBuilder>

        Attachments

          Activity

          Hide
          hovinen Bradford Hovinen added a comment -

          I have investigated the problem: it is due to an incorrect check in FitnesseExecutor.getAbsolutePathToFileThatMayBeRelativeToWorkspace: if the user specifies a directory-name which coincidentally is also the name of a directory in the root directory of the whole filesystem, then it assumes the latter and ends up passing a null pointer to ProcStarter.cmds(). The following patch fixes the problem on *Nix-systems, though it will have to be adjusted to work properly on Windows:

          diff --git a/src/main/java/hudson/plugins/fitnesse/FitnesseExecutor.java b/src/main/java/hudson/plugins/fitnesse/FitnesseExecutor.java
          index 5a12e24..60908a3 100644
          — a/src/main/java/hudson/plugins/fitnesse/FitnesseExecutor.java
          +++ b/src/main/java/hudson/plugins/fitnesse/FitnesseExecutor.java
          @@ -315,7 +315,7 @@ public class FitnesseExecutor {
          }

          static String getAbsolutePathToFileThatMayBeRelativeToWorkspace(FilePath workingDirectory, String fileName)

          { - if (new File(fileName).exists()) return fileName; + if (fileName.startsWith("/")) return fileName; return new File(workingDirectory.getRemote(), fileName).getAbsolutePath(); }

          }

          Show
          hovinen Bradford Hovinen added a comment - I have investigated the problem: it is due to an incorrect check in FitnesseExecutor.getAbsolutePathToFileThatMayBeRelativeToWorkspace: if the user specifies a directory-name which coincidentally is also the name of a directory in the root directory of the whole filesystem, then it assumes the latter and ends up passing a null pointer to ProcStarter.cmds(). The following patch fixes the problem on *Nix-systems, though it will have to be adjusted to work properly on Windows: diff --git a/src/main/java/hudson/plugins/fitnesse/FitnesseExecutor.java b/src/main/java/hudson/plugins/fitnesse/FitnesseExecutor.java index 5a12e24..60908a3 100644 — a/src/main/java/hudson/plugins/fitnesse/FitnesseExecutor.java +++ b/src/main/java/hudson/plugins/fitnesse/FitnesseExecutor.java @@ -315,7 +315,7 @@ public class FitnesseExecutor { } static String getAbsolutePathToFileThatMayBeRelativeToWorkspace(FilePath workingDirectory, String fileName) { - if (new File(fileName).exists()) return fileName; + if (fileName.startsWith("/")) return fileName; return new File(workingDirectory.getRemote(), fileName).getAbsolutePath(); } }
          Hide
          antoine_aumjaud Antoine Aumjaud added a comment -

          fixed in v1.10

          Show
          antoine_aumjaud Antoine Aumjaud added a comment - fixed in v1.10

            People

            • Assignee:
              antoine_aumjaud Antoine Aumjaud
              Reporter:
              hovinen Bradford Hovinen
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: