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

JDK Parameter Plugin 1.2 Null pointer exception when the build is triggered remotely via URL with an Authentication Token

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • JDK Parameter 1.2
      Jenkins 2.389

      JDK Parameter Plugin 1.2 regression bug breaks builds triggered remotely via URL with a Authentication Token.
      https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/Trigger-Jenkins-Builds-Remotely-Example-403-Error-Fix

      After triggering the build I get this error when using JDK Parameter Plugin v1.2.

      FATAL: null
      java.lang.NullPointerException
      	at java.base/java.util.TreeMap.getEntry(TreeMap.java:345)
      	at java.base/java.util.TreeMap.containsKey(TreeMap.java:231)
      	at java.base/java.util.TreeSet.contains(TreeSet.java:234)
      	at hudson.model.ParametersAction.isSafeParameter(ParametersAction.java:364)
      	at hudson.model.ParametersAction.filter(ParametersAction.java:335)
      	at hudson.model.ParametersAction.getParameters(ParametersAction.java:182)
      	at hudson.model.ParametersAction.iterator(ParametersAction.java:177)
      	at hudson.model.AbstractBuild.getBuildVariables(AbstractBuild.java:1071)
      	at hudson.scm.SubversionSCM.getLocations(SubversionSCM.java:544)
      	at hudson.scm.SubversionSCM.buildEnvironment(SubversionSCM.java:730)
      	at hudson.scm.SCM.buildEnvVars(SCM.java:589)
      	at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:967)
      	at hudson.maven.AbstractMavenBuild.getEnvironment(AbstractMavenBuild.java:57)
      	at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:168)
      	at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:887)
      	at hudson.scm.SCM.checkout(SCM.java:540)
      	at hudson.model.AbstractProject.checkout(AbstractProject.java:1240)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:649)
      	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:85)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:521)
      	at hudson.model.Run.execute(Run.java:1900)
      	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
      	at hudson.model.ResourceController.execute(ResourceController.java:101)
      	at hudson.model.Executor.run(Executor.java:442)  

      I had to downgrade to v1.0 to get it working again.

          [JENKINS-70551] JDK Parameter Plugin 1.2 Null pointer exception when the build is triggered remotely via URL with an Authentication Token

          Mark Waite added a comment -

          That stack trace does not include any component from the JDK parameters plugin.  I have no idea how the change to the JDK parameters plugin would induce that error.  The code that is reporting the null pointer exception is inside the Java TreeMap code.

          Mark Waite added a comment - That stack trace does not include any component from the JDK parameters plugin.  I have no idea how the change to the JDK parameters plugin would induce that error.  The code that is reporting the null pointer exception is inside the Java TreeMap code.

          Leo Leung added a comment -

          A parameter in the build is null when it is remotely triggered by the URL. It's not necessarily the JDK parameter, but since it started happening after upgrading to 1.2, it's probably that.

          The project config uses "(Default)" as the default JDK, it's not passed in via the trigger URL. Maybe somehow the JDK parameter becomes null when triggered via URL using 1.2, works fine with 1.0.

          Leo Leung added a comment - A parameter in the build is null when it is remotely triggered by the URL. It's not necessarily the JDK parameter, but since it started happening after upgrading to 1.2, it's probably that. The project config uses "(Default)" as the default JDK, it's not passed in via the trigger URL. Maybe somehow the JDK parameter becomes null when triggered via URL using 1.2, works fine with 1.0.

          Tim added a comment -

          Had the same issue. Seems like the problem occurs with both, 1.0 and 1.2, but not 1.1. The problem seems to be that 1.0 and 1.2 try to get the parameter name from the stapler request, which might not include it. 1.1 gets it from the parameter definition. The issue causing this problem seems to be: https://github.com/jenkinsci/JDK_Parameter_Plugin-plugin/commit/fa087e1af2530d04a7d2aeb9e21809e66e65c030

          Tim added a comment - Had the same issue. Seems like the problem occurs with both, 1.0 and 1.2, but not 1.1. The problem seems to be that 1.0 and 1.2 try to get the parameter name from the stapler request, which might not include it. 1.1 gets it from the parameter definition. The issue causing this problem seems to be: https://github.com/jenkinsci/JDK_Parameter_Plugin-plugin/commit/fa087e1af2530d04a7d2aeb9e21809e66e65c030

          Mark Waite added a comment -

          timvahlbrock your statement seems to contradict the original description. The original description says:

          I had to downgrade to v1.0 to get it working again.

          You say that:

          Seems like the problem occurs with both, 1.0 and 1.2, but not 1.1.

          That seems to me like you are saying something different than what was said by leo_, since a downgrade to 1.0 resolved it for leo_.

          If https://github.com/jenkinsci/JDK_Parameter_Plugin-plugin/commit/fa087e1af2530d04a7d2aeb9e21809e66e65c030 is the problem, then I can't explain how you're seeing the problem in 1.0, since that commit was not included in the 1.0 release or the 1.1 release.

          I struggle to see how the issue could be due to JDK parameter plugin 1.2 when JDK parameter plugin 1.2 is the same Java source code as JDK parameter plugin 1.0. Between those releases there were changes in 3 jelly files (to add the escape-by-default tag), an update of the parent pom, and removal of unused maven plugin dependency declarations from the pom.

          Mark Waite added a comment - timvahlbrock your statement seems to contradict the original description. The original description says: I had to downgrade to v1.0 to get it working again. You say that: Seems like the problem occurs with both, 1.0 and 1.2, but not 1.1. That seems to me like you are saying something different than what was said by leo_ , since a downgrade to 1.0 resolved it for leo_ . If https://github.com/jenkinsci/JDK_Parameter_Plugin-plugin/commit/fa087e1af2530d04a7d2aeb9e21809e66e65c030 is the problem, then I can't explain how you're seeing the problem in 1.0, since that commit was not included in the 1.0 release or the 1.1 release. I struggle to see how the issue could be due to JDK parameter plugin 1.2 when JDK parameter plugin 1.2 is the same Java source code as JDK parameter plugin 1.0. Between those releases there were changes in 3 jelly files (to add the escape-by-default tag), an update of the parent pom, and removal of unused maven plugin dependency declarations from the pom.

          Tim added a comment - - edited

          I'm neither a Jenkins nor a Stapler nor a Jelly expert but what we found out during debugging is: The exception occurs, because here the JDK Parameter Plugins tries to fetch  the name of the parameter from the Stapler Request, but it returns null. This statement is included in 1.0, but was changed in 22a7162] to add support for REST API calls. [fa087e1|https://github.com/jenkinsci/JDK_Parameter_Plugin-plugin/commit/fa087e1af2530d04a7d2aeb9e21809e66e65c030] reverts those changes and even states that it reverts 22a7162 at the end of the commit message.

          I hope this helps to clarify my point of view.

          Btw: the built-in Jenkins parameters do get the parameter name from the parameter definition, just as the changes introduced in 22a7162 do. But then again: I'm neither an expert on Jenkins nor Stapler nor Jelly.

          Tim added a comment - - edited I'm neither a Jenkins nor a Stapler nor a Jelly expert but what we found out during debugging is: The exception occurs, because here the JDK Parameter Plugins tries to fetch  the name of the parameter from the Stapler Request, but it returns null. This statement is included in 1.0, but was changed in 22a7162 ] to add support for REST API calls. [fa087e1| https://github.com/jenkinsci/JDK_Parameter_Plugin-plugin/commit/fa087e1af2530d04a7d2aeb9e21809e66e65c030 ] reverts those changes and even states that it reverts 22a7162 at the end of the commit message. I hope this helps to clarify my point of view. Btw: the built-in Jenkins parameters do get the parameter name from the parameter definition, just as the changes introduced in 22a7162 do. But then again: I'm neither an expert on Jenkins nor Stapler nor Jelly.

            Unassigned Unassigned
            leo_ Leo Leung
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: