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

NPE from CpsCallableInvocation.<init> when passing null to one-arg method

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • pipeline

      I was observing the following behavior:

      This works:

      node("master") {
          testMethod(null, new Object())
      }
      
      def testMethod(myparameter,mysecondparameter) {
       echo "test"
      }
      

      This fails:

      node("master") {
          testMethod(null)
      }
      
      def testMethod(myparameter) {
       echo "test"
      }
      

      I was expecting that it should be possible to pass in a single parameter with a null value.

          [JENKINS-29990] NPE from CpsCallableInvocation.<init> when passing null to one-arg method

          Bastian Echterhoelter created issue -
          Bastian Echterhoelter made changes -
          Description Original: I was observing the following behavior:

          This works:
          {code}
          node("master") {
              testMethod(null, new Object())
          }

          def testMethod(myparameter,mysecondparameter) {
           echo "test"
          }
          {code}

          This fails:
          {code}
          node("master") {
              testMethod(null)
          }

          def testMethod(myparameter) {
           echo test
          }
          {code}

          I was expecting that it should be possible to pass in a single parameter with a null value.
          New: I was observing the following behavior:

          This works:
          {code}
          node("master") {
              testMethod(null, new Object())
          }

          def testMethod(myparameter,mysecondparameter) {
           echo "test"
          }
          {code}

          This fails:
          {code}
          node("master") {
              testMethod(null)
          }

          def testMethod(myparameter) {
           echo "test"
          }
          {code}

          I was expecting that it should be possible to pass in a single parameter with a null value.
          Jesse Glick made changes -
          Labels New: groovy
          Summary Original: Nullpointer exception on methods with one parameter and provided value is null New: NPE from CpsCallableInvocation.<init> when passing null to one-arg method
          Jesse Glick made changes -
          Link New: This issue duplicates JENKINS-32062 [ JENKINS-32062 ]
          Jesse Glick made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 165069 ] New: JNJira + In-Review [ 197609 ]
          Andrew Bayer made changes -
          Component/s New: pipeline-general [ 21692 ]
          Andrew Bayer made changes -
          Component/s Original: workflow-plugin [ 18820 ]

            jglick Jesse Glick
            nexus49 Bastian Echterhoelter
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: