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

NPE thrown when a job uses an automatically installed JDK

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • versionnumber-plugin
    • None
    • versionnumber-plugin 1.5
      core 1.609.2

    Description

      When a job is using an automatically installed JDK and when the JDK is not available yet on build node, this NPE is thrown:

      ERROR: java.lang.NullPointerException
      java.lang.NullPointerException
      	at hudson.Launcher$ProcStarter.stdout(Launcher.java:262)
      	at hudson.tools.AbstractCommandInstaller.performInstallation(AbstractCommandInstaller.java:77)
      	at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:68)
      	at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:107)
      	at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:205)
      	at hudson.model.JDK.forNode(JDK.java:130)
      	at hudson.model.AbstractProject.getEnvironment(AbstractProject.java:355)
      	at hudson.model.Run.getEnvironment(Run.java:2228)
      	at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:932)
      	at org.jvnet.hudson.tools.versionnumber.VersionNumberBuilder.getPreviousBuildWithVersionNumber(VersionNumberBuilder.java:204)
      	at org.jvnet.hudson.tools.versionnumber.VersionNumberBuilder.incBuild(VersionNumberBuilder.java:242)
      	at org.jvnet.hudson.tools.versionnumber.VersionNumberBuilder.setUp(VersionNumberBuilder.java:497)
      	at hudson.model.Build$BuildExecution.doRun(Build.java:154)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:536)
      	at hudson.model.Run.execute(Run.java:1738)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:381)
      

      Plugin is calling build.getEnvironment(null) here. Passing null doesn't seem to be legal.

      Attachments

        Issue Links

          Activity

            Code changed in jenkins
            User: Deniz Bahadir
            Path:
            src/main/java/org/jvnet/hudson/tools/versionnumber/VersionNumberBuilder.java
            http://jenkins-ci.org/commit/versionnumber-plugin/2bdfc0d00c077a4de19fa30828a31817b65cce4f
            Log:
            Merge pull request #10 from ydubreuil/fix-JENKINS-30224

            JENKINS-30224 use real listener to prevent NPE

            Compare: https://github.com/jenkinsci/versionnumber-plugin/compare/68c526dcb586...2bdfc0d00c07

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Deniz Bahadir Path: src/main/java/org/jvnet/hudson/tools/versionnumber/VersionNumberBuilder.java http://jenkins-ci.org/commit/versionnumber-plugin/2bdfc0d00c077a4de19fa30828a31817b65cce4f Log: Merge pull request #10 from ydubreuil/fix- JENKINS-30224 JENKINS-30224 use real listener to prevent NPE Compare: https://github.com/jenkinsci/versionnumber-plugin/compare/68c526dcb586...2bdfc0d00c07
            bahadir Deniz Bahadir added a comment -

            I merged your pull-request.

            bahadir Deniz Bahadir added a comment - I merged your pull-request.

            bahadir Thanks for merging my fix. Would you mind cutting a new release of the plugin?

            ydubreuil Yoann Dubreuil added a comment - bahadir Thanks for merging my fix. Would you mind cutting a new release of the plugin?
            bahadir Deniz Bahadir added a comment -

            I released a new version 1.6 of the plugin. It should be available in the plugin-list within the next 8 hours.

            Sorry for the delay. I did expect that releasing the plugin was someone else's responsibility. But as it seems, nobody else felt responsible for it and my access-rights where obviously enough to release it myself, so I just did that.

            I hope, everything worked as expected. If not, please notify me again.

            bahadir Deniz Bahadir added a comment - I released a new version 1.6 of the plugin. It should be available in the plugin-list within the next 8 hours. Sorry for the delay. I did expect that releasing the plugin was someone else's responsibility. But as it seems, nobody else felt responsible for it and my access-rights where obviously enough to release it myself, so I just did that. I hope, everything worked as expected. If not, please notify me again.

            Thanks a lot! Release worked, I can find the plugin in Update Center

            ydubreuil Yoann Dubreuil added a comment - Thanks a lot! Release worked, I can find the plugin in Update Center

            People

              ydubreuil Yoann Dubreuil
              ydubreuil Yoann Dubreuil
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: