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

NullPointerException when credentialsId is null

      with the following:
      {{   steps {}}
      {{     withCredentials([}}
      {{       string(credentialsId: params.GITHUB_PASSWORD, variable: 'GITHUB_PASSWORD'),}}
      {{       string(credentialsId: params.GITHUB_APP_SECRET, variable: 'GITHUB_APP_SECRET')}}
          ]) {
            ansiblePlaybook(    {{      }}
              ...
            )
      {{    }}}
      {{  }}}

       

      if param.GITHUB_PASSWORD is null (not defined), a NullPointerException is raised.

      The code in com.cloudbees.plugins.credentials.CredentialsProvider.findCredentialById should check for null value of id and provide a more useful message than a stacktrace.

       

       

          [JENKINS-43264] NullPointerException when credentialsId is null

          Cyril Jouve created issue -
          Cyril Jouve made changes -
          Description Original: {{with the following:}}
          {{  steps \{}}
          {{    withCredentials([}}
          {{      string(credentialsId: params.GITHUB_PASSWORD, variable: 'GITHUB_PASSWORD'),}}
          {{      string(credentialsId: params.GITHUB_APP_SECRET, variable: 'GITHUB_APP_SECRET')}}
          {{   ]) \{}}
          {{ ansiblePlaybook(}}{{    .....}}
          {{ )}}
          {{ }}}

           

          if param.GITHUB_PASSWORD is null (not defined), a NullPointerException is raised.

          The code in com.cloudbees.plugins.credentials.CredentialsProvider.findCredentialById should check for null value of id and provide a more useful message than a stacktrace.

           

           
          New: {{with the following:}}
          {{   steps \{}}
          {{     withCredentials([}}
          {{       string(credentialsId: params.GITHUB_PASSWORD, variable: 'GITHUB_PASSWORD'),}}
          {{       string(credentialsId: params.GITHUB_APP_SECRET, variable: 'GITHUB_APP_SECRET')}}
          {{    ]) \{}}
          {{      ansiblePlaybook(    }}{{      }}
          {{        ...}}
          {{      )}}
          {{    }}}
          {{  }}}

           

          if param.GITHUB_PASSWORD is null (not defined), a NullPointerException is raised.

          The code in com.cloudbees.plugins.credentials.CredentialsProvider.findCredentialById should check for null value of id and provide a more useful message than a stacktrace.

           

           
          Stephen Connolly made changes -
          Component/s New: credentials-binding-plugin [ 18129 ]
          Component/s Original: credentials-plugin [ 16523 ]
          Stephen Connolly made changes -
          Assignee Original: Stephen Connolly [ stephenconnolly ]

          Stephen Connolly added a comment - https://github.com/jenkinsci/credentials-binding-plugin/blob/master/src/main/java/org/jenkinsci/plugins/credentialsbinding/impl/BindingStep.java#L224  credentials-binding plugin not credentials plugin
          Jesse Glick made changes -
          Summary Original: NullPointerException when credentialid is not found New: NullPointerException when credentialsId is null
          Jesse Glick made changes -
          Labels New: diagnostics

          Jesse Glick added a comment -

          This is a user error but MultiBinding.getCredentials could be improved to report it more clearly.

          Jesse Glick added a comment - This is a user error but MultiBinding.getCredentials could be improved to report it more clearly.

            Unassigned Unassigned
            jouve Cyril Jouve
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: