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

NPE at echo step when wrapped inside credentials block

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      When echo statement containing a string with a variable is executed from inside withCredentials block whose username and password are empty, then build is failing with below error:

       

      java.lang.NullPointerException
       at org.jenkinsci.plugins.workflow.cps.DSL.lambda$logInterpolationWarnings$1(DSL.java:379)
       at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
       at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1556)
       at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
       at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
       at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
       at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
       at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
       at org.jenkinsci.plugins.workflow.cps.DSL.logInterpolationWarnings(DSL.java:380)
       at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:292)
       at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:193)
       at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
       at sun.reflect.GeneratedMethodAccessor2228.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:498)
       at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
       at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
       at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
       at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
       at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
       at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
       at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163)
       at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
       at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:157)
       at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161)
       at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165)
       at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
       at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
       at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)

       

      Below is the pipeline code executed which caused the above error:

       

      node('random-node') {
          withCredentials([withCredentials([            
              usernamePassword(credentialsId: 'test-creds', usernameVariable:   'USERNAME', passwordVariable: 'PASSWORD')]) { 
      
          // test-creds credential is created in Jenkins with empty values for username and password 
          // Random string containing more than 1024 characters        
      
          def str = "vipxxtdyaftkmhwktlfluinntglqgxhxbzmqrtdymiirdldqlqwkbwogghipikynerlnbzvikbstrbltvzbrwhgexagknwjrbslhtyrdrjawximhudnfpevdnfnypslcbdoahbwoymvstadapkvatuawfcuhssuejpuzkgvzqguxzcpxztpuxexvpecistficnlnxmngsfwadwiiwqsjsoirtzzuupuxtxadkcmhoewdytsddmpkvbwufqhzimawrqywiswlblsvioigswyfewctzabmppnzxwlmheleqkdgkreuraofcwgfctraahumshkwrjxljcgpyihpgapewkhzbwmnslmbgpnntxgnwtcjcpytgypsihcxntaufamhhrjtbdclyhojkxamglhbixcmknrlghpfyqmglhxzeqfixeihmkgeroyjctblvwnjefnhieainpaijplqzgfhtifvcfzfmgbocmkhheqpusznlkgbxtkmvwcnxywzhdugmdhlqjpuwhmmaadfpfgqtxvujewxejyuthzgxbfshzgokinkrrkzqiuogdafsajslofavaxxgpxouiqwmpkjetmeqhvjagmufwopanpwtoigfmvvriqcjqywviqirfdhxkxyijvvkjujzsndlctbuzwapkppkmgdveodmskxtzsbizeizyblusifyzamhxemdsodvjpvurmjfmsvajvnpwwvhrdnfmvmicjdjtiawqquhyxaugtgsojmkzjlbanvceapbmmzunhbaoucukvplwrrdyvhasovtjnuhzanvxfycwkeymweinubqezuuqcqgqoaynwrkuohfwmjfvzlklumeawmkcqardbuhwpowsrjbevmaioojsvcdlieyqtdzwfoavtqgygltuayrfnkbuvecyatpvydctavglzdexlywqwqahnlidvdnrlvkmexlvtvmmfqzjpdzhaauraqszxsyhflnnwruswgrqulnewshsledbwotfwjgdozmzuwa"        
      
         echo "${str}"    
         }
      }

       

      This error seem to be observed only when:

      1. username and password are empty in the credential
      2. echo step prints a variable
      3. no. of characters set in the value of the variable is more than 1024 characters

       

        Attachments

          Activity

          v_sachin Sachin V created issue -
          v_sachin Sachin V made changes -
          Field Original Value New Value
          Description When echo statement containing a string with a variable is executed from inside withCredentials block whose username and password are empty, then build is failing with following error:
          java.lang.NullPointerException
            at org.jenkinsci.plugins.workflow.cps.DSL.lambda$logInterpolationWarnings$1(DSL.java:379)
            at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
            at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1556)
            at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
            at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
            at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
            at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
            at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
            at org.jenkinsci.plugins.workflow.cps.DSL.logInterpolationWarnings(DSL.java:380)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:292)
            at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:193)
            at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
            at sun.reflect.GeneratedMethodAccessor2228.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
            at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
            at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
            at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
            at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
            at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
            at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163)
            at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
            at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:157)
            at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161)
            at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165)
            at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
            at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
            at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
          Below is the pipeline code executed which caused the above error:

           
          {code:java}
          node('random-node') {
              withCredentials([withCredentials([           
                  usernamePassword(credentialsId: 'test-creds', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {

              // test-creds credential is created in Jenkins with empty values for username and password
              // Random string containing more than 1024 characters       

              def str = "vipxxtdyaftkmhwktlfluinntglqgxhxbzmqrtdymiirdldqlqwkbwogghipikynerlnbzvikbstrbltvzbrwhgexagknwjrbslhtyrdrjawximhudnfpevdnfnypslcbdoahbwoymvstadapkvatuawfcuhssuejpuzkgvzqguxzcpxztpuxexvpecistficnlnxmngsfwadwiiwqsjsoirtzzuupuxtxadkcmhoewdytsddmpkvbwufqhzimawrqywiswlblsvioigswyfewctzabmppnzxwlmheleqkdgkreuraofcwgfctraahumshkwrjxljcgpyihpgapewkhzbwmnslmbgpnntxgnwtcjcpytgypsihcxntaufamhhrjtbdclyhojkxamglhbixcmknrlghpfyqmglhxzeqfixeihmkgeroyjctblvwnjefnhieainpaijplqzgfhtifvcfzfmgbocmkhheqpusznlkgbxtkmvwcnxywzhdugmdhlqjpuwhmmaadfpfgqtxvujewxejyuthzgxbfshzgokinkrrkzqiuogdafsajslofavaxxgpxouiqwmpkjetmeqhvjagmufwopanpwtoigfmvvriqcjqywviqirfdhxkxyijvvkjujzsndlctbuzwapkppkmgdveodmskxtzsbizeizyblusifyzamhxemdsodvjpvurmjfmsvajvnpwwvhrdnfmvmicjdjtiawqquhyxaugtgsojmkzjlbanvceapbmmzunhbaoucukvplwrrdyvhasovtjnuhzanvxfycwkeymweinubqezuuqcqgqoaynwrkuohfwmjfvzlklumeawmkcqardbuhwpowsrjbevmaioojsvcdlieyqtdzwfoavtqgygltuayrfnkbuvecyatpvydctavglzdexlywqwqahnlidvdnrlvkmexlvtvmmfqzjpdzhaauraqszxsyhflnnwruswgrqulnewshsledbwotfwjgdozmzuwa"       

             echo "${str}"   
             }
          }{code}
           

          This error seem to be observed only when:
           # username and password are empty in the credential
           # echo step prints a variable
           # no. of characters set in the value of the variable is more than 1024 characters

           
          When echo statement containing a string with a variable is executed from inside withCredentials block whose username and password are empty, then build is failing with following error:

           
          {noformat}
          java.lang.NullPointerException
           at org.jenkinsci.plugins.workflow.cps.DSL.lambda$logInterpolationWarnings$1(DSL.java:379)
           at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
           at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1556)
           at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
           at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
           at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
           at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
           at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
           at org.jenkinsci.plugins.workflow.cps.DSL.logInterpolationWarnings(DSL.java:380)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:292)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:193)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at sun.reflect.GeneratedMethodAccessor2228.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
           at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
           at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
           at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
           at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
           at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163)
           at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
           at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:157)
           at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
           at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17){noformat}
           


           Below is the pipeline code executed which caused the above error:

           
          {code:java}
          node('random-node') {
              withCredentials([withCredentials([           
                  usernamePassword(credentialsId: 'test-creds', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {

              // test-creds credential is created in Jenkins with empty values for username and password
              // Random string containing more than 1024 characters       

              def str = "vipxxtdyaftkmhwktlfluinntglqgxhxbzmqrtdymiirdldqlqwkbwogghipikynerlnbzvikbstrbltvzbrwhgexagknwjrbslhtyrdrjawximhudnfpevdnfnypslcbdoahbwoymvstadapkvatuawfcuhssuejpuzkgvzqguxzcpxztpuxexvpecistficnlnxmngsfwadwiiwqsjsoirtzzuupuxtxadkcmhoewdytsddmpkvbwufqhzimawrqywiswlblsvioigswyfewctzabmppnzxwlmheleqkdgkreuraofcwgfctraahumshkwrjxljcgpyihpgapewkhzbwmnslmbgpnntxgnwtcjcpytgypsihcxntaufamhhrjtbdclyhojkxamglhbixcmknrlghpfyqmglhxzeqfixeihmkgeroyjctblvwnjefnhieainpaijplqzgfhtifvcfzfmgbocmkhheqpusznlkgbxtkmvwcnxywzhdugmdhlqjpuwhmmaadfpfgqtxvujewxejyuthzgxbfshzgokinkrrkzqiuogdafsajslofavaxxgpxouiqwmpkjetmeqhvjagmufwopanpwtoigfmvvriqcjqywviqirfdhxkxyijvvkjujzsndlctbuzwapkppkmgdveodmskxtzsbizeizyblusifyzamhxemdsodvjpvurmjfmsvajvnpwwvhrdnfmvmicjdjtiawqquhyxaugtgsojmkzjlbanvceapbmmzunhbaoucukvplwrrdyvhasovtjnuhzanvxfycwkeymweinubqezuuqcqgqoaynwrkuohfwmjfvzlklumeawmkcqardbuhwpowsrjbevmaioojsvcdlieyqtdzwfoavtqgygltuayrfnkbuvecyatpvydctavglzdexlywqwqahnlidvdnrlvkmexlvtvmmfqzjpdzhaauraqszxsyhflnnwruswgrqulnewshsledbwotfwjgdozmzuwa"       

             echo "${str}"   
             }
          }{code}
           

          This error seem to be observed only when:
           # username and password are empty in the credential
           # echo step prints a variable
           # no. of characters set in the value of the variable is more than 1024 characters

           
          v_sachin Sachin V made changes -
          Description When echo statement containing a string with a variable is executed from inside withCredentials block whose username and password are empty, then build is failing with following error:

           
          {noformat}
          java.lang.NullPointerException
           at org.jenkinsci.plugins.workflow.cps.DSL.lambda$logInterpolationWarnings$1(DSL.java:379)
           at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
           at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1556)
           at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
           at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
           at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
           at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
           at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
           at org.jenkinsci.plugins.workflow.cps.DSL.logInterpolationWarnings(DSL.java:380)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:292)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:193)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at sun.reflect.GeneratedMethodAccessor2228.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
           at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
           at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
           at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
           at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
           at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163)
           at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
           at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:157)
           at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
           at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17){noformat}
           


           Below is the pipeline code executed which caused the above error:

           
          {code:java}
          node('random-node') {
              withCredentials([withCredentials([           
                  usernamePassword(credentialsId: 'test-creds', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {

              // test-creds credential is created in Jenkins with empty values for username and password
              // Random string containing more than 1024 characters       

              def str = "vipxxtdyaftkmhwktlfluinntglqgxhxbzmqrtdymiirdldqlqwkbwogghipikynerlnbzvikbstrbltvzbrwhgexagknwjrbslhtyrdrjawximhudnfpevdnfnypslcbdoahbwoymvstadapkvatuawfcuhssuejpuzkgvzqguxzcpxztpuxexvpecistficnlnxmngsfwadwiiwqsjsoirtzzuupuxtxadkcmhoewdytsddmpkvbwufqhzimawrqywiswlblsvioigswyfewctzabmppnzxwlmheleqkdgkreuraofcwgfctraahumshkwrjxljcgpyihpgapewkhzbwmnslmbgpnntxgnwtcjcpytgypsihcxntaufamhhrjtbdclyhojkxamglhbixcmknrlghpfyqmglhxzeqfixeihmkgeroyjctblvwnjefnhieainpaijplqzgfhtifvcfzfmgbocmkhheqpusznlkgbxtkmvwcnxywzhdugmdhlqjpuwhmmaadfpfgqtxvujewxejyuthzgxbfshzgokinkrrkzqiuogdafsajslofavaxxgpxouiqwmpkjetmeqhvjagmufwopanpwtoigfmvvriqcjqywviqirfdhxkxyijvvkjujzsndlctbuzwapkppkmgdveodmskxtzsbizeizyblusifyzamhxemdsodvjpvurmjfmsvajvnpwwvhrdnfmvmicjdjtiawqquhyxaugtgsojmkzjlbanvceapbmmzunhbaoucukvplwrrdyvhasovtjnuhzanvxfycwkeymweinubqezuuqcqgqoaynwrkuohfwmjfvzlklumeawmkcqardbuhwpowsrjbevmaioojsvcdlieyqtdzwfoavtqgygltuayrfnkbuvecyatpvydctavglzdexlywqwqahnlidvdnrlvkmexlvtvmmfqzjpdzhaauraqszxsyhflnnwruswgrqulnewshsledbwotfwjgdozmzuwa"       

             echo "${str}"   
             }
          }{code}
           

          This error seem to be observed only when:
           # username and password are empty in the credential
           # echo step prints a variable
           # no. of characters set in the value of the variable is more than 1024 characters

           
          When echo statement containing a string with a variable is executed from inside withCredentials block whose username and password are empty, then build is failing with following error:

           
          {noformat}
          java.lang.NullPointerException
           at org.jenkinsci.plugins.workflow.cps.DSL.lambda$logInterpolationWarnings$1(DSL.java:379)
           at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
           at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1556)
           at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
           at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
           at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
           at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
           at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
           at org.jenkinsci.plugins.workflow.cps.DSL.logInterpolationWarnings(DSL.java:380)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:292)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:193)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at sun.reflect.GeneratedMethodAccessor2228.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
           at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
           at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
           at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
           at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
           at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163)
           at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
           at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:157)
           at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
           at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17){noformat}
           

          Below is the pipeline code executed which caused the above error:

           
          {code:java}
          node('random-node') {
              withCredentials([withCredentials([           
                  usernamePassword(credentialsId: 'test-creds', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {

              // test-creds credential is created in Jenkins with empty values for username and password
              // Random string containing more than 1024 characters       

              def str = "vipxxtdyaftkmhwktlfluinntglqgxhxbzmqrtdymiirdldqlqwkbwogghipikynerlnbzvikbstrbltvzbrwhgexagknwjrbslhtyrdrjawximhudnfpevdnfnypslcbdoahbwoymvstadapkvatuawfcuhssuejpuzkgvzqguxzcpxztpuxexvpecistficnlnxmngsfwadwiiwqsjsoirtzzuupuxtxadkcmhoewdytsddmpkvbwufqhzimawrqywiswlblsvioigswyfewctzabmppnzxwlmheleqkdgkreuraofcwgfctraahumshkwrjxljcgpyihpgapewkhzbwmnslmbgpnntxgnwtcjcpytgypsihcxntaufamhhrjtbdclyhojkxamglhbixcmknrlghpfyqmglhxzeqfixeihmkgeroyjctblvwnjefnhieainpaijplqzgfhtifvcfzfmgbocmkhheqpusznlkgbxtkmvwcnxywzhdugmdhlqjpuwhmmaadfpfgqtxvujewxejyuthzgxbfshzgokinkrrkzqiuogdafsajslofavaxxgpxouiqwmpkjetmeqhvjagmufwopanpwtoigfmvvriqcjqywviqirfdhxkxyijvvkjujzsndlctbuzwapkppkmgdveodmskxtzsbizeizyblusifyzamhxemdsodvjpvurmjfmsvajvnpwwvhrdnfmvmicjdjtiawqquhyxaugtgsojmkzjlbanvceapbmmzunhbaoucukvplwrrdyvhasovtjnuhzanvxfycwkeymweinubqezuuqcqgqoaynwrkuohfwmjfvzlklumeawmkcqardbuhwpowsrjbevmaioojsvcdlieyqtdzwfoavtqgygltuayrfnkbuvecyatpvydctavglzdexlywqwqahnlidvdnrlvkmexlvtvmmfqzjpdzhaauraqszxsyhflnnwruswgrqulnewshsledbwotfwjgdozmzuwa"       

             echo "${str}"   
             }
          }{code}
           

          This error seem to be observed only when:
           # username and password are empty in the credential
           # echo step prints a variable
           # no. of characters set in the value of the variable is more than 1024 characters

           
          v_sachin Sachin V made changes -
          Description When echo statement containing a string with a variable is executed from inside withCredentials block whose username and password are empty, then build is failing with following error:

           
          {noformat}
          java.lang.NullPointerException
           at org.jenkinsci.plugins.workflow.cps.DSL.lambda$logInterpolationWarnings$1(DSL.java:379)
           at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
           at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1556)
           at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
           at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
           at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
           at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
           at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
           at org.jenkinsci.plugins.workflow.cps.DSL.logInterpolationWarnings(DSL.java:380)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:292)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:193)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at sun.reflect.GeneratedMethodAccessor2228.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
           at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
           at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
           at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
           at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
           at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163)
           at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
           at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:157)
           at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
           at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17){noformat}
           

          Below is the pipeline code executed which caused the above error:

           
          {code:java}
          node('random-node') {
              withCredentials([withCredentials([           
                  usernamePassword(credentialsId: 'test-creds', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {

              // test-creds credential is created in Jenkins with empty values for username and password
              // Random string containing more than 1024 characters       

              def str = "vipxxtdyaftkmhwktlfluinntglqgxhxbzmqrtdymiirdldqlqwkbwogghipikynerlnbzvikbstrbltvzbrwhgexagknwjrbslhtyrdrjawximhudnfpevdnfnypslcbdoahbwoymvstadapkvatuawfcuhssuejpuzkgvzqguxzcpxztpuxexvpecistficnlnxmngsfwadwiiwqsjsoirtzzuupuxtxadkcmhoewdytsddmpkvbwufqhzimawrqywiswlblsvioigswyfewctzabmppnzxwlmheleqkdgkreuraofcwgfctraahumshkwrjxljcgpyihpgapewkhzbwmnslmbgpnntxgnwtcjcpytgypsihcxntaufamhhrjtbdclyhojkxamglhbixcmknrlghpfyqmglhxzeqfixeihmkgeroyjctblvwnjefnhieainpaijplqzgfhtifvcfzfmgbocmkhheqpusznlkgbxtkmvwcnxywzhdugmdhlqjpuwhmmaadfpfgqtxvujewxejyuthzgxbfshzgokinkrrkzqiuogdafsajslofavaxxgpxouiqwmpkjetmeqhvjagmufwopanpwtoigfmvvriqcjqywviqirfdhxkxyijvvkjujzsndlctbuzwapkppkmgdveodmskxtzsbizeizyblusifyzamhxemdsodvjpvurmjfmsvajvnpwwvhrdnfmvmicjdjtiawqquhyxaugtgsojmkzjlbanvceapbmmzunhbaoucukvplwrrdyvhasovtjnuhzanvxfycwkeymweinubqezuuqcqgqoaynwrkuohfwmjfvzlklumeawmkcqardbuhwpowsrjbevmaioojsvcdlieyqtdzwfoavtqgygltuayrfnkbuvecyatpvydctavglzdexlywqwqahnlidvdnrlvkmexlvtvmmfqzjpdzhaauraqszxsyhflnnwruswgrqulnewshsledbwotfwjgdozmzuwa"       

             echo "${str}"   
             }
          }{code}
           

          This error seem to be observed only when:
           # username and password are empty in the credential
           # echo step prints a variable
           # no. of characters set in the value of the variable is more than 1024 characters

           
          When echo statement containing a string with a variable is executed from inside withCredentials block whose username and password are empty, then build is failing with below error:

           
          {noformat}
          java.lang.NullPointerException
           at org.jenkinsci.plugins.workflow.cps.DSL.lambda$logInterpolationWarnings$1(DSL.java:379)
           at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
           at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1556)
           at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
           at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
           at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
           at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
           at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
           at org.jenkinsci.plugins.workflow.cps.DSL.logInterpolationWarnings(DSL.java:380)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:292)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:193)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at sun.reflect.GeneratedMethodAccessor2228.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
           at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
           at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
           at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
           at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
           at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163)
           at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
           at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:157)
           at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
           at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:135)
           at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17){noformat}
           

          Below is the pipeline code executed which caused the above error:

           
          {code:java}
          node('random-node') {
              withCredentials([withCredentials([           
                  usernamePassword(credentialsId: 'test-creds', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {

              // test-creds credential is created in Jenkins with empty values for username and password
              // Random string containing more than 1024 characters       

              def str = "vipxxtdyaftkmhwktlfluinntglqgxhxbzmqrtdymiirdldqlqwkbwogghipikynerlnbzvikbstrbltvzbrwhgexagknwjrbslhtyrdrjawximhudnfpevdnfnypslcbdoahbwoymvstadapkvatuawfcuhssuejpuzkgvzqguxzcpxztpuxexvpecistficnlnxmngsfwadwiiwqsjsoirtzzuupuxtxadkcmhoewdytsddmpkvbwufqhzimawrqywiswlblsvioigswyfewctzabmppnzxwlmheleqkdgkreuraofcwgfctraahumshkwrjxljcgpyihpgapewkhzbwmnslmbgpnntxgnwtcjcpytgypsihcxntaufamhhrjtbdclyhojkxamglhbixcmknrlghpfyqmglhxzeqfixeihmkgeroyjctblvwnjefnhieainpaijplqzgfhtifvcfzfmgbocmkhheqpusznlkgbxtkmvwcnxywzhdugmdhlqjpuwhmmaadfpfgqtxvujewxejyuthzgxbfshzgokinkrrkzqiuogdafsajslofavaxxgpxouiqwmpkjetmeqhvjagmufwopanpwtoigfmvvriqcjqywviqirfdhxkxyijvvkjujzsndlctbuzwapkppkmgdveodmskxtzsbizeizyblusifyzamhxemdsodvjpvurmjfmsvajvnpwwvhrdnfmvmicjdjtiawqquhyxaugtgsojmkzjlbanvceapbmmzunhbaoucukvplwrrdyvhasovtjnuhzanvxfycwkeymweinubqezuuqcqgqoaynwrkuohfwmjfvzlklumeawmkcqardbuhwpowsrjbevmaioojsvcdlieyqtdzwfoavtqgygltuayrfnkbuvecyatpvydctavglzdexlywqwqahnlidvdnrlvkmexlvtvmmfqzjpdzhaauraqszxsyhflnnwruswgrqulnewshsledbwotfwjgdozmzuwa"       

             echo "${str}"   
             }
          }{code}
           

          This error seem to be observed only when:
           # username and password are empty in the credential
           # echo step prints a variable
           # no. of characters set in the value of the variable is more than 1024 characters

           
          Priority Critical [ 2 ] Minor [ 4 ]
          v_sachin Sachin V made changes -
          Priority Minor [ 4 ] Major [ 3 ]

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            v_sachin Sachin V
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: