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

Null Pointer exception when no default parameter provided

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-parameter-plugin
    • Jenkins 2.46
      Git Parameter Plug-in 2.4.5
      Git Plugin 3.3.0
      Git Client plugin 2.4.5

      I see the following error frequently in /var/log/jenkins/jenkins.log

       

      Aug 15, 2017 10:27:06 PM net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition getDefaultParameterValue
      SEVERE: nullUnexpected error!
      java.lang.NullPointerException

      I assume this is occurring because I did not set a default value for the Git Parameter on many jobs. A default value should not be required, or a missing default value should at least be handled better. 

       

      The exception is probably being thrown here:

      https://github.com/jenkinsci/git-parameter-plugin/blob/5b14c821d41e896f1f0b619c4d1daee18f716785/src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/GitParameterDefinition.java#L150

          [JENKINS-46216] Null Pointer exception when no default parameter provided

          Hi mksmith,

          Can you add some more information about your environment (versions of: Git client plugin, Git plugin, Git Parameter Plug-In) and more logs (mayby you have full stack trace)

          Default value is not mandatory.

          Please look at this issue JENKINS-44087. Is not this the same thing?

           

          Regards

          Boguslaw

           

          Boguslaw Klimas added a comment - Hi mksmith , Can you add some more information about your environment (versions of: Git client plugin, Git plugin, Git Parameter Plug-In) and more logs (mayby you have full stack trace) Default value is not mandatory. Please look at this issue  JENKINS-44087 . Is not this the same thing?   Regards Boguslaw  

          Matthew Smith added a comment -

          I've updated the environment with more versions. I'm not really sure how to get more of a stack trace, since the Jenkins logs just show the message I posted above (around every 10 minutes). 

          My understanding of 44087 is that the exception would occur if a job was never built. That is a possibility in my case, however I don't know why this would be causing an exception so frequently. And I'm also not sure which build would be causing this (since there are many jobs on our Jenkins server that use the Git Parameter plugin. 

          Matthew Smith added a comment - I've updated the environment with more versions. I'm not really sure how to get more of a stack trace, since the Jenkins logs just show the message I posted above (around every 10 minutes).  My understanding of 44087 is that the exception would occur if a job was never built. That is a possibility in my case, however I don't know why this would be causing an exception so frequently. And I'm also not sure which build would be causing this (since there are many jobs on our Jenkins server that use the Git Parameter plugin. 

          Code changed in jenkins
          User: Boguslaw Klimas
          Path:
          src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/GitParameterDefinition.java
          src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/WorkflowJobWrapper.java
          http://jenkins-ci.org/commit/git-parameter-plugin/e3869b10b05b76f1f78f32ccbf7c539624e3e230
          Log:
          Merge pull request #52 from jenkinsci/bugfix/JENKINS-46216

          Null Pointer exception when no default parameter provided

          Compare: https://github.com/jenkinsci/git-parameter-plugin/compare/d8a0c6f66e0f...e3869b10b05b

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Boguslaw Klimas Path: src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/GitParameterDefinition.java src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/jobs/WorkflowJobWrapper.java http://jenkins-ci.org/commit/git-parameter-plugin/e3869b10b05b76f1f78f32ccbf7c539624e3e230 Log: Merge pull request #52 from jenkinsci/bugfix/ JENKINS-46216 Null Pointer exception when no default parameter provided Compare: https://github.com/jenkinsci/git-parameter-plugin/compare/d8a0c6f66e0f...e3869b10b05b

          Hi mksmith

          I was change a way to get the job name, this should eliminate 'null' in log.
          In Jenkins log you should have full stacktrace eg.

          maj 04, 2017 10:12:28 PM net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition generateContents 
          SEVERE: [ Learn_github_2 ] Niespodziewany błąd! 
          java.lang.NullPointerException 
                 at hudson.model.Fingerprint.addFor(Fingerprint.java:1023) 
                 at com.cloudbees.plugins.credentials.CredentialsProvider.trackAll(CredentialsProvider.java:1458) 
                 at com.cloudbees.plugins.credentials.CredentialsProvider.track(CredentialsProvider.java:1422) 
                 at hudson.plugins.git.GitSCM.createClient(GitSCM.java:767) 
                 at hudson.plugins.git.GitSCM.createClient(GitSCM.java:743) 
                 at net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition.getGitClient(GitParameterDefinition.java:457)
                 ...

          Boguslaw Klimas added a comment - Hi mksmith I was change a way to get the job name, this should eliminate 'null' in log. In Jenkins log you should have full stacktrace eg. maj 04, 2017 10:12:28 PM net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition generateContents SEVERE: [ Learn_github_2 ] Niespodziewany błąd! java.lang.NullPointerException        at hudson.model.Fingerprint.addFor(Fingerprint.java:1023)        at com.cloudbees.plugins.credentials.CredentialsProvider.trackAll(CredentialsProvider.java:1458)        at com.cloudbees.plugins.credentials.CredentialsProvider.track(CredentialsProvider.java:1422)        at hudson.plugins.git.GitSCM.createClient(GitSCM.java:767)        at hudson.plugins.git.GitSCM.createClient(GitSCM.java:743)        at net.uaznia.lukanus.hudson.plugins.gitparameter.GitParameterDefinition.getGitClient(GitParameterDefinition.java:457) ...

          release 0.8.1

          Boguslaw Klimas added a comment - release 0.8.1

            klimas7 Boguslaw Klimas
            mksmith Matthew Smith
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: