[JIRA] (JENKINS-57844) NullPointerException in NodeJSBuildWrapper.java:166

8 views
Skip to first unread message

soundcracker@gmail.com (JIRA)

unread,
Jun 4, 2019, 10:44:03 AM6/4/19
to jenkinsc...@googlegroups.com
Daniel Estermann created an issue
 
Jenkins / Bug JENKINS-57844
NullPointerException in NodeJSBuildWrapper.java:166
Issue Type: Bug Bug
Assignee: Nikolas Falco
Components: nodejs-plugin
Created: 2019-06-04 14:43
Environment: nodejs-plugin 1.3.0
Priority: Major Major
Reporter: Daniel Estermann

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="nod...@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="nod...@1.2.9">
  <nodeJSInstallationName>NodeJS_9_latest</nodeJSInstallationName>
</jenkins.plugins.nodejs.NodeJSBuildWrapper>

And apparently the instance of NodeJSBuildWrapper isn't built via constructor but probably via some reflection magic (unfortunately I cannot explain how exactly).

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

 

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

soundcracker@gmail.com (JIRA)

unread,
Jun 4, 2019, 11:14:03 AM6/4/19
to jenkinsc...@googlegroups.com
Daniel Estermann updated an issue
Change By: Daniel Estermann
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:

 
{noformat}

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){noformat}
After some research and debugging I figured out the root of this issue. The plugin introduced cache locator strategy in commit [32039bd|https://github.com/jenkinsci/nodejs-plugin/commit/32039bdd59a30361ca420c5e3e8c909d073060d3]. It also guarantees that cache locator strategy cannot be null both after calling the [constructor|https://github.com/jenkinsci/nodejs-plugin/blob/master/src/main/java/jenkins/plugins/nodejs/NodeJSBuildWrapper.java#L102] and calling the appropriate [setter method|https://github.com/jenkinsci/nodejs-plugin/blob/master/src/main/java/jenkins/plugins/nodejs/NodeJSBuildWrapper.java#L133]. 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:

 
{noformat}

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

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:

 
{noformat}

<jenkins.plugins.nodejs.NodeJSBuildWrapper plugin="nod...@1.2.9">
  <nodeJSInstallationName>NodeJS_9_latest</nodeJSInstallationName>
</jenkins.plugins.nodejs.NodeJSBuildWrapper>{noformat}
And apparently the instance of NodeJSBuildWrapper isn't built via constructor but
probably via some reflection magic (unfortunately I cannot explain how exactly)  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?

 

 

soundcracker@gmail.com (JIRA)

unread,
Jun 4, 2019, 11:18:08 AM6/4/19
to jenkinsc...@googlegroups.com
Daniel Estermann commented on Bug JENKINS-57844
 
Re: NullPointerException in NodeJSBuildWrapper.java:166

What I've learned from the documentation is that you need `readResolve()` method, when introducing a new field.

soundcracker@gmail.com (JIRA)

unread,
Jun 4, 2019, 11:18:09 AM6/4/19
to jenkinsc...@googlegroups.com
Daniel Estermann edited a comment on Bug JENKINS-57844
What I've learned from the [documentation|https://wiki.jenkins.io/display/JENKINS/Hint+on+retaining+backward+compatibility] is that you need `readResolve()` method, when introducing a new field to retain backward compatibility .

soundcracker@gmail.com (JIRA)

unread,
Jun 4, 2019, 12:22:03 PM6/4/19
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages