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

readCSV fails when passing CSVFormat

    Details

    • Similar Issues:

      Description

      Hi,

       

      I would like to read a csv String or file as documented here: https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/

      When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with error [1].

      Steps to reproduce:  

      execute following script in a pipeline:

        

      node(''){
         String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner='1003764')\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""
         def rec = readCSV text: csv, format: CSVFormat.DEFAULT
       }

       

      [1]:

      java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
       at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
       at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
       at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
       at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
       at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
       at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
       at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
       at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
       at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
       at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
       at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
       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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
       Caused: java.lang.IllegalArgumentException: Could not instantiate
      {text="[http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner='1003764|http://opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=] ')", "hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1", format=Delimiter=<,> QuoteChar=<"> RecordSeparator=< > EmptyLines:ignored SkipHeaderRecord:false}
      for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
       at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
       at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
       at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
       at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
       at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
       at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
       at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
       at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
       at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
       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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
       at WorkflowScript.run(WorkflowScript:4)
       at __cps.transform__(Native Method)
       at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
       at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
       at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
       at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:498)
       at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
       at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
       at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
       at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:498)
       at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
       at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
       at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
       at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
       at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:498)
       at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
       at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
       at com.cloudbees.groovy.cps.Next.step(Next.java:83)
       at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
       at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
       at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
       at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
       at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
       at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
       at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
       at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
       at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
       at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
       at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
       at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
       at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
       at java.lang.Thread.run(Thread.java:748)
       Finished: FAILURE
        
        
      

       

        Attachments

          Activity

          fgeckeler Florian Geckeler created issue -
          fgeckeler Florian Geckeler made changes -
          Field Original Value New Value
          Description Hi,

           

          I would like to read a csv String or file like documented here: [official docu title|[https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]].

           

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with following error:
          {quote}java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
           at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           Caused: java.lang.IllegalArgumentException: Could not instantiate

          {text="[http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764|http://opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=] ')", "hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1", format=Delimiter=<,> QuoteChar=<"> RecordSeparator=< > EmptyLines:ignored SkipHeaderRecord:false}

          for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           at WorkflowScript.run(WorkflowScript:4)
           at ___cps.transform___(Native Method)
           at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
           at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
           at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
           at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
           at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
           at com.cloudbees.groovy.cps.Next.step(Next.java:83)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
           at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
           at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
           at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
           at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
           at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
           at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
           at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
           at java.lang.Thread.run(Thread.java:748)
           Finished: FAILURE
            
           Page generated: Jun 21, 2019 8:43:34 AM UTC[REST API|https://cloudpot.cpe.c.eu-de-1.cloud.sap/job/sandbox-pipeline/1199/api/][Jenkins ver. 2.164.3|https://jenkins.io/]
          {quote}
           

           


           Steps to reproduce:  

          execute following script in a pipeline:

           

          node('')

          { String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\"" def rec = readCSV text: csv, format: CSVFormat.DEFAULT }
          Hi,

           

          I would like to read a csv String or file like documented here: [official docu title|[https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]].

           

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with following error:
          {quote}java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
           at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           Caused: java.lang.IllegalArgumentException: Could not instantiate
          Unknown macro: \{text="[http}
          for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           at WorkflowScript.run(WorkflowScript:4)
           at ___cps.transform___(Native Method)
           at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
           at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
           at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
           at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
           at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
           at com.cloudbees.groovy.cps.Next.step(Next.java:83)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
           at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
           at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
           at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
           at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
           at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
           at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
           at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
           at java.lang.Thread.run(Thread.java:748)
           Finished: FAILURE
            
           Page generated: Jun 21, 2019 8:43:34 AM UTC[REST API|https://cloudpot.cpe.c.eu-de-1.cloud.sap/job/sandbox-pipeline/1199/api/][Jenkins ver. 2.164.3|https://jenkins.io/]
          {quote}
           

           

          Steps to reproduce:  

          execute following script in a pipeline:

           

          node('')

          {
            String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""
            def rec = readCSV text: csv, format: CSVFormat.DEFAULT
          }
          fgeckeler Florian Geckeler made changes -
          Description Hi,

           

          I would like to read a csv String or file like documented here: [official docu title|[https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]].

           

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with following error:
          {quote}java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
           at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           Caused: java.lang.IllegalArgumentException: Could not instantiate
          Unknown macro: \{text="[http}
          for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           at WorkflowScript.run(WorkflowScript:4)
           at ___cps.transform___(Native Method)
           at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
           at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
           at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
           at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
           at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
           at com.cloudbees.groovy.cps.Next.step(Next.java:83)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
           at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
           at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
           at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
           at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
           at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
           at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
           at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
           at java.lang.Thread.run(Thread.java:748)
           Finished: FAILURE
            
           Page generated: Jun 21, 2019 8:43:34 AM UTC[REST API|https://cloudpot.cpe.c.eu-de-1.cloud.sap/job/sandbox-pipeline/1199/api/][Jenkins ver. 2.164.3|https://jenkins.io/]
          {quote}
           

           

          Steps to reproduce:  

          execute following script in a pipeline:

           

          node('')

          {
            String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""
            def rec = readCSV text: csv, format: CSVFormat.DEFAULT
          }
          Hi,

           

          I would like to read a csv String or file like documented here: [official docu title|[https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]].

           

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with following error:
          {quote}java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
           at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           Caused: java.lang.IllegalArgumentException: Could not instantiate
           Unknown macro: \{text="[http}
           for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           at WorkflowScript.run(WorkflowScript:4)
           at ___cps.transform___(Native Method)
           at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
           at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
           at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
           at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
           at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
           at com.cloudbees.groovy.cps.Next.step(Next.java:83)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
           at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
           at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
           at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
           at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
           at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
           at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
           at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
           at java.lang.Thread.run(Thread.java:748)
           Finished: FAILURE
            
           Page generated: Jun 21, 2019 8:43:34 AM UTC[REST API|https://cloudpot.cpe.c.eu-de-1.cloud.sap/job/sandbox-pipeline/1199/api/][Jenkins ver. 2.164.3|https://jenkins.io/]
          {quote}
           

           

          Steps to reproduce:  

          execute following script in a pipeline:

           

          {{node('')}}{{{   }}
          {{  String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""   def rec = }}
          {{  readCSV text: csv, format: CSVFormat.DEFAULT }}
          {{}}}
          fgeckeler Florian Geckeler made changes -
          Description Hi,

           

          I would like to read a csv String or file like documented here: [official docu title|[https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]].

           

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with following error:
          {quote}java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
           at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           Caused: java.lang.IllegalArgumentException: Could not instantiate
           Unknown macro: \{text="[http}
           for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           at WorkflowScript.run(WorkflowScript:4)
           at ___cps.transform___(Native Method)
           at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
           at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
           at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
           at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
           at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
           at com.cloudbees.groovy.cps.Next.step(Next.java:83)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
           at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
           at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
           at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
           at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
           at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
           at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
           at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
           at java.lang.Thread.run(Thread.java:748)
           Finished: FAILURE
            
           Page generated: Jun 21, 2019 8:43:34 AM UTC[REST API|https://cloudpot.cpe.c.eu-de-1.cloud.sap/job/sandbox-pipeline/1199/api/][Jenkins ver. 2.164.3|https://jenkins.io/]
          {quote}
           

           

          Steps to reproduce:  

          execute following script in a pipeline:

           

          {{node('')}}{{{   }}
          {{  String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""   def rec = }}
          {{  readCSV text: csv, format: CSVFormat.DEFAULT }}
          {{}}}
          Hi,

           

          I would like to read a csv String or file like documented here: [official docu title|[https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]].

           

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with following error:
          {quote}java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
           at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           Caused: java.lang.IllegalArgumentException: Could not instantiate
           Unknown macro: \{text="[http}
           for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           at WorkflowScript.run(WorkflowScript:4)
           at ___cps.transform___(Native Method)
           at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
           at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
           at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
           at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
           at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
           at com.cloudbees.groovy.cps.Next.step(Next.java:83)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
           at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
           at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
           at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
           at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
           at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
           at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
           at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
           at java.lang.Thread.run(Thread.java:748)
           Finished: FAILURE
            
           Page generated: Jun 21, 2019 8:43:34 AM UTC[REST API|https://cloudpot.cpe.c.eu-de-1.cloud.sap/job/sandbox-pipeline/1199/api/][Jenkins ver. 2.164.3|https://jenkins.io/]
          {quote}
           

           

          Steps to reproduce:  

          execute following script in a pipeline:

           

          {{node(''){}}
          {{  String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""}}
          {{  def rec = readCSV text: csv, format: CSVFormat.DEFAULT}}
          {{}}}
          fgeckeler Florian Geckeler made changes -
          Description Hi,

           

          I would like to read a csv String or file like documented here: [official docu title|[https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]].

           

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with following error:
          {quote}java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
           at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           Caused: java.lang.IllegalArgumentException: Could not instantiate
           Unknown macro: \{text="[http}
           for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           at WorkflowScript.run(WorkflowScript:4)
           at ___cps.transform___(Native Method)
           at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
           at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
           at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
           at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
           at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
           at com.cloudbees.groovy.cps.Next.step(Next.java:83)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
           at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
           at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
           at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
           at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
           at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
           at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
           at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
           at java.lang.Thread.run(Thread.java:748)
           Finished: FAILURE
            
           Page generated: Jun 21, 2019 8:43:34 AM UTC[REST API|https://cloudpot.cpe.c.eu-de-1.cloud.sap/job/sandbox-pipeline/1199/api/][Jenkins ver. 2.164.3|https://jenkins.io/]
          {quote}
           

           

          Steps to reproduce:  

          execute following script in a pipeline:

           

          {{node(''){}}
          {{  String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""}}
          {{  def rec = readCSV text: csv, format: CSVFormat.DEFAULT}}
          {{}}}
          Hi,

           

          I would like to read a csv String or file like documented here: [official docu title| [https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]].

           

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with following error:
          {quote}java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
           at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           Caused: java.lang.IllegalArgumentException: Could not instantiate
           Unknown macro: \{text="[http}
           for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           at WorkflowScript.run(WorkflowScript:4)
           at ___cps.transform___(Native Method)
           at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
           at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
           at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
           at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
           at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
           at com.cloudbees.groovy.cps.Next.step(Next.java:83)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
           at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
           at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
           at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
           at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
           at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
           at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
           at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
           at java.lang.Thread.run(Thread.java:748)
           Finished: FAILURE
            
           Page generated: Jun 21, 2019 8:43:34 AM UTC[REST API|https://cloudpot.cpe.c.eu-de-1.cloud.sap/job/sandbox-pipeline/1199/api/][Jenkins ver. 2.164.3|https://jenkins.io/]
          {quote}
           

           

          Steps to reproduce:  

          execute following script in a pipeline:

           

          {{node(''){}}
           {{  String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""}}
           {{  def rec = readCSV text: csv, format: CSVFormat.DEFAULT}}
           {{}}}
          fgeckeler Florian Geckeler made changes -
          Description Hi,

           

          I would like to read a csv String or file like documented here: [official docu title| [https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]].

           

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with following error:
          {quote}java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
           at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           Caused: java.lang.IllegalArgumentException: Could not instantiate
           Unknown macro: \{text="[http}
           for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           at WorkflowScript.run(WorkflowScript:4)
           at ___cps.transform___(Native Method)
           at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
           at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
           at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
           at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
           at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
           at com.cloudbees.groovy.cps.Next.step(Next.java:83)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
           at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
           at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
           at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
           at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
           at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
           at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
           at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
           at java.lang.Thread.run(Thread.java:748)
           Finished: FAILURE
            
           Page generated: Jun 21, 2019 8:43:34 AM UTC[REST API|https://cloudpot.cpe.c.eu-de-1.cloud.sap/job/sandbox-pipeline/1199/api/][Jenkins ver. 2.164.3|https://jenkins.io/]
          {quote}
           

           

          Steps to reproduce:  

          execute following script in a pipeline:

           

          {{node(''){}}
           {{  String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""}}
           {{  def rec = readCSV text: csv, format: CSVFormat.DEFAULT}}
           {{}}}
          Hi,

           

          I would like to read a csv String or file as documented here: [https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]

           

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with following error:
          {quote}java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
           at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           Caused: java.lang.IllegalArgumentException: Could not instantiate
           Unknown macro: \{text="[http}
           for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           at WorkflowScript.run(WorkflowScript:4)
           at ___cps.transform___(Native Method)
           at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
           at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
           at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
           at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
           at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
           at com.cloudbees.groovy.cps.Next.step(Next.java:83)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
           at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
           at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
           at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
           at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
           at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
           at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
           at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
           at java.lang.Thread.run(Thread.java:748)
           Finished: FAILURE
            
           Page generated: Jun 21, 2019 8:43:34 AM UTC[REST API|https://cloudpot.cpe.c.eu-de-1.cloud.sap/job/sandbox-pipeline/1199/api/][Jenkins ver. 2.164.3|https://jenkins.io/]
          {quote}
           

           

          Steps to reproduce:  

          execute following script in a pipeline:

           

          {{node(''){}}
           {{  String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""}}
           {{  def rec = readCSV text: csv, format: CSVFormat.DEFAULT}}
           {{}}}
          fgeckeler Florian Geckeler made changes -
          Description Hi,

           

          I would like to read a csv String or file as documented here: [https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]

           

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with following error:
          {quote}java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
           at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           Caused: java.lang.IllegalArgumentException: Could not instantiate
           Unknown macro: \{text="[http}
           for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           at WorkflowScript.run(WorkflowScript:4)
           at ___cps.transform___(Native Method)
           at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
           at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
           at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
           at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
           at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
           at com.cloudbees.groovy.cps.Next.step(Next.java:83)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
           at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
           at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
           at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
           at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
           at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
           at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
           at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
           at java.lang.Thread.run(Thread.java:748)
           Finished: FAILURE
            
           Page generated: Jun 21, 2019 8:43:34 AM UTC[REST API|https://cloudpot.cpe.c.eu-de-1.cloud.sap/job/sandbox-pipeline/1199/api/][Jenkins ver. 2.164.3|https://jenkins.io/]
          {quote}
           

           

          Steps to reproduce:  

          execute following script in a pipeline:

           

          {{node(''){}}
           {{  String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""}}
           {{  def rec = readCSV text: csv, format: CSVFormat.DEFAULT}}
           {{}}}
          Hi,

           

          I would like to read a csv String or file as documented here: [https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]

           

          {{node(''){}}
           {{  String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""}}
           {{  def rec = readCSV text: csv, format: CSVFormat.DEFAULT}}
           {{}}}

           

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with following error:
          {quote}java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
           at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           Caused: java.lang.IllegalArgumentException: Could not instantiate
           Unknown macro: \{text="[http}
           for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           at WorkflowScript.run(WorkflowScript:4)
           at ___cps.transform___(Native Method)
           at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
           at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
           at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
           at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
           at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
           at com.cloudbees.groovy.cps.Next.step(Next.java:83)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
           at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
           at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
           at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
           at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
           at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
           at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
           at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
           at java.lang.Thread.run(Thread.java:748)
           Finished: FAILURE
            
           Page generated: Jun 21, 2019 8:43:34 AM UTC[REST API|https://cloudpot.cpe.c.eu-de-1.cloud.sap/job/sandbox-pipeline/1199/api/][Jenkins ver. 2.164.3|https://jenkins.io/]
          {quote}
           

           

          Steps to reproduce:  

          execute following script in a pipeline:

           

           
          fgeckeler Florian Geckeler made changes -
          Description Hi,

           

          I would like to read a csv String or file as documented here: [https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]

           

          {{node(''){}}
           {{  String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""}}
           {{  def rec = readCSV text: csv, format: CSVFormat.DEFAULT}}
           {{}}}

           

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with following error:
          {quote}java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
           at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           Caused: java.lang.IllegalArgumentException: Could not instantiate
           Unknown macro: \{text="[http}
           for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           at WorkflowScript.run(WorkflowScript:4)
           at ___cps.transform___(Native Method)
           at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
           at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
           at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
           at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
           at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
           at com.cloudbees.groovy.cps.Next.step(Next.java:83)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
           at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
           at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
           at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
           at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
           at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
           at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
           at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
           at java.lang.Thread.run(Thread.java:748)
           Finished: FAILURE
            
           Page generated: Jun 21, 2019 8:43:34 AM UTC[REST API|https://cloudpot.cpe.c.eu-de-1.cloud.sap/job/sandbox-pipeline/1199/api/][Jenkins ver. 2.164.3|https://jenkins.io/]
          {quote}
           

           

          Steps to reproduce:  

          execute following script in a pipeline:

           

           
          Hi,

           

          I would like to read a csv String or file as documented here: [https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with error [1].

          Steps to reproduce:  

          execute following script in a pipeline:

            

          {{node(''){}}
           {{  String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""}}
           {{  def rec = readCSV text: csv, format: CSVFormat.DEFAULT}}
           {{}}}

           

          [1]:

           
          ava.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
          at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
          at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
          at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
          at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
          at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
          at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
          at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
          at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
          at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
          at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
          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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
          Caused: java.lang.IllegalArgumentException: Could not instantiate {text="[http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764|http://opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=]
          ')", "hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1", format=Delimiter=<,> QuoteChar=<"> RecordSeparator=<
          > EmptyLines:ignored SkipHeaderRecord:false} for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
          at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
          at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
          at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
          at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
          at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
          at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
          at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
          at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
          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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
          at WorkflowScript.run(WorkflowScript:4)
          at ___cps.transform___(Native Method)
          at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
          at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
          at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
          at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
          at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
          at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
          at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
          at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
          at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
          at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
          at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
          at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
          at com.cloudbees.groovy.cps.Next.step(Next.java:83)
          at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
          at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
          at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
          at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
          at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
          at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
          at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
          at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
          at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
          Finished: FAILURE
           
           
          fgeckeler Florian Geckeler made changes -
          Description Hi,

           

          I would like to read a csv String or file as documented here: [https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with error [1].

          Steps to reproduce:  

          execute following script in a pipeline:

            

          {{node(''){}}
           {{  String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""}}
           {{  def rec = readCSV text: csv, format: CSVFormat.DEFAULT}}
           {{}}}

           

          [1]:

           
          ava.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
          at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
          at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
          at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
          at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
          at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
          at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
          at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
          at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
          at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
          at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
          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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
          Caused: java.lang.IllegalArgumentException: Could not instantiate {text="[http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764|http://opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=]
          ')", "hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1", format=Delimiter=<,> QuoteChar=<"> RecordSeparator=<
          > EmptyLines:ignored SkipHeaderRecord:false} for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
          at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
          at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
          at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
          at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
          at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
          at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
          at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
          at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
          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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
          at WorkflowScript.run(WorkflowScript:4)
          at ___cps.transform___(Native Method)
          at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
          at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
          at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
          at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
          at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
          at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
          at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
          at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
          at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
          at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
          at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
          at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
          at com.cloudbees.groovy.cps.Next.step(Next.java:83)
          at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
          at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
          at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
          at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
          at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
          at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
          at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
          at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
          at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
          Finished: FAILURE
           
           
          Hi,

           

          I would like to read a csv String or file as documented here: [https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with error [1].

          Steps to reproduce:  

          execute following script in a pipeline:

            

          {{node(''){}}
           {{  String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""}}
           {{  def rec = readCSV text: csv, format: CSVFormat.DEFAULT}}
           {{}}}

           

          [1]:

          {{ }}
          {{java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat}}
          {{ at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)}}
          {{ at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)}}
          {{ at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)}}
          {{ at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)}}
          {{ at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)}}
          {{ at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)}}
          {{ at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)}}
          {{ at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)}}
          {{ at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)}}
          {{ at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)}}
          {{ at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)}}
          {{ 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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)}}
          {{ Caused: java.lang.IllegalArgumentException: Could not instantiate}}{{{text="[http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764|http://opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=] ')", "hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1", format=Delimiter=<,> QuoteChar=<"> RecordSeparator=< > EmptyLines:ignored SkipHeaderRecord:false}}}{{for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)}}
          {{ at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)}}
          {{ at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)}}
          {{ at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)}}
          {{ at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)}}
          {{ at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)}}
          {{ at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)}}
          {{ at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)}}
          {{ at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)}}
          {{ at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)}}
          {{ 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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)}}
          {{ at WorkflowScript.run(WorkflowScript:4)}}
          {{ at ___cps.transform___(Native Method)}}
          {{ at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)}}
          {{ at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)}}
          {{ at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)}}
          {{ at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)}}
          {{ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)}}
          {{ at java.lang.reflect.Method.invoke(Method.java:498)}}
          {{ at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)}}
          {{ at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)}}
          {{ at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)}}
          {{ at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)}}
          {{ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)}}
          {{ at java.lang.reflect.Method.invoke(Method.java:498)}}
          {{ at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)}}
          {{ at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)}}
          {{ at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)}}
          {{ at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)}}
          {{ at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)}}
          {{ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)}}
          {{ at java.lang.reflect.Method.invoke(Method.java:498)}}
          {{ at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)}}
          {{ at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)}}
          {{ at com.cloudbees.groovy.cps.Next.step(Next.java:83)}}
          {{ at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)}}
          {{ at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)}}
          {{ at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)}}
          {{ at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)}}
          {{ at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)}}
          {{ at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)}}
          {{ at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)}}
          {{ at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)}}
          {{ at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)}}
          {{ at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)}}
          {{ at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)}}
          {{ at java.util.concurrent.FutureTask.run(FutureTask.java:266)}}
          {{ at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)}}
          {{ at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)}}
          {{ at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)}}
          {{ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)}}
          {{ at java.util.concurrent.FutureTask.run(FutureTask.java:266)}}
          {{ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)}}
          {{ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)}}
          {{ at java.lang.Thread.run(Thread.java:748)}}
          {{ Finished: FAILURE}}
          {{  }}
          {{  }}
          fgeckeler Florian Geckeler made changes -
          Description Hi,

           

          I would like to read a csv String or file as documented here: [https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with error [1].

          Steps to reproduce:  

          execute following script in a pipeline:

            

          {{node(''){}}
           {{  String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""}}
           {{  def rec = readCSV text: csv, format: CSVFormat.DEFAULT}}
           {{}}}

           

          [1]:

          {{ }}
          {{java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat}}
          {{ at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)}}
          {{ at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)}}
          {{ at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)}}
          {{ at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)}}
          {{ at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)}}
          {{ at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)}}
          {{ at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)}}
          {{ at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)}}
          {{ at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)}}
          {{ at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)}}
          {{ at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)}}
          {{ 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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)}}
          {{ Caused: java.lang.IllegalArgumentException: Could not instantiate}}{{{text="[http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764|http://opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=] ')", "hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1", format=Delimiter=<,> QuoteChar=<"> RecordSeparator=< > EmptyLines:ignored SkipHeaderRecord:false}}}{{for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)}}
          {{ at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)}}
          {{ at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)}}
          {{ at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)}}
          {{ at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)}}
          {{ at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)}}
          {{ at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)}}
          {{ at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)}}
          {{ at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)}}
          {{ at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)}}
          {{ 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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)}}
          {{ at WorkflowScript.run(WorkflowScript:4)}}
          {{ at ___cps.transform___(Native Method)}}
          {{ at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)}}
          {{ at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)}}
          {{ at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)}}
          {{ at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)}}
          {{ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)}}
          {{ at java.lang.reflect.Method.invoke(Method.java:498)}}
          {{ at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)}}
          {{ at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)}}
          {{ at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)}}
          {{ at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)}}
          {{ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)}}
          {{ at java.lang.reflect.Method.invoke(Method.java:498)}}
          {{ at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)}}
          {{ at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)}}
          {{ at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)}}
          {{ at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)}}
          {{ at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)}}
          {{ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)}}
          {{ at java.lang.reflect.Method.invoke(Method.java:498)}}
          {{ at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)}}
          {{ at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)}}
          {{ at com.cloudbees.groovy.cps.Next.step(Next.java:83)}}
          {{ at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)}}
          {{ at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)}}
          {{ at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)}}
          {{ at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)}}
          {{ at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)}}
          {{ at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)}}
          {{ at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)}}
          {{ at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)}}
          {{ at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)}}
          {{ at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)}}
          {{ at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)}}
          {{ at java.util.concurrent.FutureTask.run(FutureTask.java:266)}}
          {{ at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)}}
          {{ at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)}}
          {{ at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)}}
          {{ at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)}}
          {{ at java.util.concurrent.FutureTask.run(FutureTask.java:266)}}
          {{ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)}}
          {{ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)}}
          {{ at java.lang.Thread.run(Thread.java:748)}}
          {{ Finished: FAILURE}}
          {{  }}
          {{  }}
          Hi,

           

          I would like to read a csv String or file as documented here: [https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with error [1].

          Steps to reproduce:  

          execute following script in a pipeline:

            

          {{node(''){}}
           {{  String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""}}
           {{  def rec = readCSV text: csv, format: CSVFormat.DEFAULT}}
           {{}}}

           

          [1]:
          java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
          at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
          at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
          at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
          at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
          at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
          at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
          at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
          at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
          at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
          at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
          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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
          Caused: java.lang.IllegalArgumentException: Could not instantiate {text="[http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764|http://opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=]
          ')", "hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1", format=Delimiter=<,> QuoteChar=<"> RecordSeparator=<
          > EmptyLines:ignored SkipHeaderRecord:false} for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
          at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
          at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
          at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
          at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
          at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
          at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
          at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
          at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
          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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
          at WorkflowScript.run(WorkflowScript:4)
          at ___cps.transform___(Native Method)
          at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
          at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
          at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
          at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
          at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
          at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
          at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
          at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
          at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
          at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
          at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
          at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
          at com.cloudbees.groovy.cps.Next.step(Next.java:83)
          at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
          at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
          at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
          at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
          at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
          at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
          at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
          at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
          at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
          Finished: FAILURE
           
           
          fgeckeler Florian Geckeler made changes -
          Description Hi,

           

          I would like to read a csv String or file as documented here: [https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with error [1].

          Steps to reproduce:  

          execute following script in a pipeline:

            

          {{node(''){}}
           {{  String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""}}
           {{  def rec = readCSV text: csv, format: CSVFormat.DEFAULT}}
           {{}}}

           

          [1]:
          java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
          at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
          at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
          at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
          at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
          at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
          at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
          at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
          at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
          at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
          at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
          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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
          Caused: java.lang.IllegalArgumentException: Could not instantiate {text="[http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764|http://opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=]
          ')", "hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1", format=Delimiter=<,> QuoteChar=<"> RecordSeparator=<
          > EmptyLines:ignored SkipHeaderRecord:false} for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
          at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
          at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
          at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
          at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
          at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
          at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
          at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
          at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
          at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
          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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
          at WorkflowScript.run(WorkflowScript:4)
          at ___cps.transform___(Native Method)
          at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
          at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
          at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
          at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
          at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
          at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
          at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
          at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
          at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
          at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
          at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
          at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
          at com.cloudbees.groovy.cps.Next.step(Next.java:83)
          at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
          at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
          at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
          at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
          at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
          at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
          at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
          at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
          at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
          at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
          Finished: FAILURE
           
           
          Hi,

           

          I would like to read a csv String or file as documented here: [https://jenkins.io/doc/pipeline/steps/pipeline-utility-steps/]

          When I pass any CSVFormat (tried it with 'DEFAULT', 'EXCEL', and using the newFormat method as well) as format to the step the pipeline fails with error [1].

          Steps to reproduce:  

          execute following script in a pipeline:

            
          {code:java}
          node(''){
             String csv = "\"http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764&#39;)\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""
             def rec = readCSV text: csv, format: CSVFormat.DEFAULT
           }{code}
           

          [1]:
          {code:java}
          java.lang.ClassCastException: class org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep.setFormat() expects class org.apache.commons.csv.CSVFormat but received class org.apache.commons.csv.CSVFormat
           at org.jenkinsci.plugins.structs.describable.DescribableModel.coerce(DescribableModel.java:446)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:386)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:290)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           Caused: java.lang.IllegalArgumentException: Could not instantiate
          {text="[http:///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=&#39;1003764|http://opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=] ')", "hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1", format=Delimiter=<,> QuoteChar=<"> RecordSeparator=< > EmptyLines:ignored SkipHeaderRecord:false}
          for ReadCSVStep(file?: String, format?: org.kohsuke.stapler.NoStaplerConstructorException: There's no @DataBoundConstructor on any constructor of class org.apache.commons.csv.CSVFormat, text?: String)
           at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:293)
           at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:25)
           at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:13)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:262)
           at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
           at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
           at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
           at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
           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 com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20)
           at WorkflowScript.run(WorkflowScript:4)
           at __cps.transform__(Native Method)
           at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
           at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
           at sun.reflect.GeneratedMethodAccessor305.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
           at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
           at sun.reflect.GeneratedMethodAccessor433.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:76)
           at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
           at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
           at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:498)
           at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
           at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
           at com.cloudbees.groovy.cps.Next.step(Next.java:83)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
           at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
           at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
           at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
           at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
           at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282)
           at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270)
           at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
           at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
           at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
           at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
           at java.lang.Thread.run(Thread.java:748)
           Finished: FAILURE
            
            
          {code}
           
          Hide
          quas Jakub Pawlinski added a comment -

          add at the top of your class/file

          import org.apache.commons.csv.CSVFormat
          
          Show
          quas Jakub Pawlinski added a comment - add at the top of your class/file import org.apache.commons.csv.CSVFormat

            People

            • Assignee:
              Unassigned
              Reporter:
              fgeckeler Florian Geckeler
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: