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

NodeJS Plugin gets NullPointerException for Cache Location after update

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • nodejs-plugin
    • None
    • nodejs-plugin 1.3.0
    • 1.3.1

      After update of nodejs-plugin from 1.2.9 to 1.3.0 the jobs, which use it, started to fail with the following stacktrace:

       

      java.lang.NullPointerException
        at jenkins.plugins.nodejs.NodeJSBuildWrapper.setUp(NodeJSBuildWrapper.java:166)
        at jenkins.tasks.SimpleBuildWrapper.setUp(SimpleBuildWrapper.java:146)
        at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:667)
        at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
        at hudson.model.Run.execute(Run.java:1818)
        at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
        at hudson.model.ResourceController.execute(ResourceController.java:97)
        at hudson.model.Executor.run(Executor.java:429)

      After some research and debugging I figured out the root of this issue. The plugin introduced cache locator strategy in commit 32039bd. It also guarantees that cache locator strategy cannot be null both after calling the constructor and calling the appropriate setter method. But that applies only if we create a new job or change the configuration for nodejs for an existing job, using nodejs-plugin 1.3.0. The config.xml of the job looks like that then:

       

      <jenkins.plugins.nodejs.NodeJSBuildWrapper plugin="nodejs@1.3.0">
        <nodeJSInstallationName>NodeJS_9_latest</nodeJSInstallationName>
        <cacheLocationStrategy class="jenkins.plugins.nodejs.cache.DefaultCacheLocationLocator"/>
      </jenkins.plugins.nodejs.NodeJSBuildWrapper>

      But if you have an existing job, which was created before nodejs-plugin 1.3.0, it is missing the configuration for cache locator strategy. Here is an example config.xml:

       

      <jenkins.plugins.nodejs.NodeJSBuildWrapper plugin="nodejs@1.2.9">
        <nodeJSInstallationName>NodeJS_9_latest</nodeJSInstallationName>
      </jenkins.plugins.nodejs.NodeJSBuildWrapper>

      And apparently the instance of NodeJSBuildWrapper isn't built via constructor but via straight object deserialization and the field is missing.

      Anway the fact is: all my nodejs jobs became broken after that update. Would it be possible to have a global fix for that?

       

       

            nfalco Nikolas Falco
            smasher Daniel Estermann
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: