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

NPE generating snippet for BindingStep

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Not clear how to reproduce.

      java.lang.RuntimeException: Failed to instantiate class org.jenkinsci.plugins.credentialsbinding.impl.BindingStep from {"stapler-class":"org.jenkinsci.plugins.credentialsbinding.impl.BindingStep","bindings":{"variable":"foo","credentialsId":["",""],"stapler-class":"org.jenkinsci.plugins.credentialsbinding.impl.StringBinding","kind":"org.jenkinsci.plugins.credentialsbinding.impl.StringBinding"}}
      	at hudson.model.Descriptor.newInstance(Descriptor.java:577)
      	at org.jenkinsci.plugins.workflow.cps.Snippetizer.doGenerateSnippet(Snippetizer.java:203)
      	at ...
      Caused by: java.lang.NullPointerException
      	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:632)
      	at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:400)
      	at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:684)
      	at org.kohsuke.stapler.RequestImpl.access$100(RequestImpl.java:81)
      	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:587)
      	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:625)
      	at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:400)
      	at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:684)
      	at org.kohsuke.stapler.RequestImpl.access$100(RequestImpl.java:81)
      	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:587)
      	at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:400)
      	at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:396)
      	at hudson.model.Descriptor.newInstance(Descriptor.java:568)
      	... 56 more
      

        Attachments

          Issue Links

            Activity

            Hide
            susie susie hernandez added a comment -

            Hi,

            I'm getting the same error than you, see below. Any update in this fix?

            java.lang.RuntimeException: Failed to instantiate class org.jenkinsci.plugins.credentialsbinding.impl.BindingStep from {"bindings":

            {"usernameVariable":"svn_username","passwordVariable":"svn_password","credentialsId":["59a9e8cb-97e8-4fca-9c4a-06764843d039",""],"stapler-class":"org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordMultiBinding","$class":"org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordMultiBinding"}

            ,"stapler-class":"org.jenkinsci.plugins.credentialsbinding.impl.BindingStep","$class":"org.jenkinsci.plugins.credentialsbinding.impl.BindingStep"}

            Show
            susie susie hernandez added a comment - Hi, I'm getting the same error than you, see below. Any update in this fix? java.lang.RuntimeException: Failed to instantiate class org.jenkinsci.plugins.credentialsbinding.impl.BindingStep from {"bindings": {"usernameVariable":"svn_username","passwordVariable":"svn_password","credentialsId":["59a9e8cb-97e8-4fca-9c4a-06764843d039",""],"stapler-class":"org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordMultiBinding","$class":"org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordMultiBinding"} ,"stapler-class":"org.jenkinsci.plugins.credentialsbinding.impl.BindingStep","$class":"org.jenkinsci.plugins.credentialsbinding.impl.BindingStep"}
            Hide
            cleclerc Cyrille Le Clerc added a comment -

            I found a workaround when I was getting an NPE generating the snippet of a "Secret File" binding.
            I first add a binding that does not break, a "Username and password (conjoined)" binding and then the "Secret File" binding that I need. And then I can generate the groovy snippet. I just have to remove the generated binding for the "Username and password (conjoined)" and I'm done.

            Show
            cleclerc Cyrille Le Clerc added a comment - I found a workaround when I was getting an NPE generating the snippet of a "Secret File" binding. I first add a binding that does not break, a "Username and password (conjoined)" binding and then the "Secret File" binding that I need. And then I can generate the groovy snippet. I just have to remove the generated binding for the "Username and password (conjoined)" and I'm done.
            Hide
            jglick Jesse Glick added a comment -

            The problem is that credentialsId is being passed as an array rather than a single value, and this code is incompatible with databinding Stephen Connolly. Somehow it works in SecretBuildWrapper in a freestyle project, not sure how.

            Show
            jglick Jesse Glick added a comment - The problem is that credentialsId is being passed as an array rather than a single value, and this code is incompatible with databinding Stephen Connolly . Somehow it works in SecretBuildWrapper in a freestyle project, not sure how.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/resources/org/jenkinsci/plugins/credentialsbinding/MultiBinding/config.jelly
            src/main/resources/org/jenkinsci/plugins/credentialsbinding/impl/BindingStep/config.jelly
            src/main/resources/org/jenkinsci/plugins/credentialsbinding/impl/SecretBuildWrapper/config.jelly
            http://jenkins-ci.org/commit/credentials-binding-plugin/1aa7d7ad6cbb6cf5ac6a4d246704de0f42af8456
            Log:
            [FIXED JENKINS-27387] Suppress expressionAllowed in BindingStep config; unnecessary and throws exceptions.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/resources/org/jenkinsci/plugins/credentialsbinding/MultiBinding/config.jelly src/main/resources/org/jenkinsci/plugins/credentialsbinding/impl/BindingStep/config.jelly src/main/resources/org/jenkinsci/plugins/credentialsbinding/impl/SecretBuildWrapper/config.jelly http://jenkins-ci.org/commit/credentials-binding-plugin/1aa7d7ad6cbb6cf5ac6a4d246704de0f42af8456 Log: [FIXED JENKINS-27387] Suppress expressionAllowed in BindingStep config; unnecessary and throws exceptions.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/resources/org/jenkinsci/plugins/credentialsbinding/MultiBinding/config.jelly
            src/main/resources/org/jenkinsci/plugins/credentialsbinding/impl/BindingStep/config.jelly
            src/main/resources/org/jenkinsci/plugins/credentialsbinding/impl/SecretBuildWrapper/config.jelly
            http://jenkins-ci.org/commit/credentials-binding-plugin/fbefd8d4646fa28d971a102c368f5bcfad5a7ac6
            Log:
            Merge pull request #15 from jglick/snippetizer-JENKINS-27387

            JENKINS-27387 NPE from Snippetizer

            Compare: https://github.com/jenkinsci/credentials-binding-plugin/compare/ed93648cf840...fbefd8d4646f

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/resources/org/jenkinsci/plugins/credentialsbinding/MultiBinding/config.jelly src/main/resources/org/jenkinsci/plugins/credentialsbinding/impl/BindingStep/config.jelly src/main/resources/org/jenkinsci/plugins/credentialsbinding/impl/SecretBuildWrapper/config.jelly http://jenkins-ci.org/commit/credentials-binding-plugin/fbefd8d4646fa28d971a102c368f5bcfad5a7ac6 Log: Merge pull request #15 from jglick/snippetizer- JENKINS-27387 JENKINS-27387 NPE from Snippetizer Compare: https://github.com/jenkinsci/credentials-binding-plugin/compare/ed93648cf840...fbefd8d4646f
            Hide
            stephenconnolly Stephen Connolly added a comment -

            The fix for this has broken the use case of binding a credentials parameter in a freestyle job

            Show
            stephenconnolly Stephen Connolly added a comment - The fix for this has broken the use case of binding a credentials parameter in a freestyle job

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                jglick Jesse Glick
              • Votes:
                3 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: