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

readCSV fails when passing CSVFormat

    XMLWordPrintable

Details

    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

        Issue Links

          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}
             

            add at the top of your class/file

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

            On Jenkins 2.303.1 + pipeline-utility-steps 2.10.0 this now fails even with the import

            Reproducible with:

            import org.apache.commons.csv.CSVFormat
            
            def text = '"COL1","COL2"\n"R1C1","R1C2"\n'
            def csv = readCSV(text: text, format: CSVFormat.DEFAULT)
            echo("$csv")
            
            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:492)
            	at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:429)
            	at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:331)
            	at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:272)
            	at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
            	at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:24)
            	at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:12)
            	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:299)
            	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:193)
            	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
            	at jdk.internal.reflect.GeneratedMethodAccessor51705.invoke(Unknown Source)
            	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
            	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
            	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
            	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
            	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
            	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
            	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
            	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
            	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163)
            	at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
            	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:158)
            	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:143)
            	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161)
            	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165)
            	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
            Caused: java.lang.IllegalArgumentException: Could not instantiate {text="COL1","COL2"
            "R1C1","R1C2"
            , format=Delimiter=<,> QuoteChar=<"> RecordSeparator=<
            > EmptyLines:ignored SkipHeaderRecord:false} for org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep
            	at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:334)
            	at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:272)
            	at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205)
            	at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:24)
            	at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:12)
            	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:299)
            	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:193)
            	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
            	at jdk.internal.reflect.GeneratedMethodAccessor51705.invoke(Unknown Source)
            	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
            	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
            	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
            	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
            	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
            	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
            	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
            	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
            	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163)
            	at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
            	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:158)
            	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:143)
            	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161)
            	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165)
            	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
            	at WorkflowScript.run(WorkflowScript:4)
            	at ___cps.transform___(Native Method)
            	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:86)
            	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:113)
            	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83)
            	at jdk.internal.reflect.GeneratedMethodAccessor230.invoke(Unknown Source)
            	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
            	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 jdk.internal.reflect.GeneratedMethodAccessor272.invoke(Unknown Source)
            	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
            	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 jdk.internal.reflect.GeneratedMethodAccessor242.invoke(Unknown Source)
            	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
            	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.SandboxContinuable.access$001(SandboxContinuable.java:18)
            	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
            	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:185)
            	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:400)
            	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96)
            	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:312)
            	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:276)
            	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)
            	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
            	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139)
            	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
            	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
            	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
            	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
            	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
            	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
            	at java.base/java.lang.Thread.run(Unknown Source)
            
            sbgerdp Gert Palok added a comment - On Jenkins 2.303.1 + pipeline-utility-steps 2.10.0 this now fails even with the import Reproducible with: import org.apache.commons.csv.CSVFormat def text = ' "COL1" , "COL2" \n "R1C1" , "R1C2" \n' def csv = readCSV(text: text, format: CSVFormat.DEFAULT) echo( "$csv" ) 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:492) at org.jenkinsci.plugins.structs.describable.DescribableModel.injectSetters(DescribableModel.java:429) at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:331) at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:272) at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205) at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:24) at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:12) at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:299) at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:193) at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122) at jdk.internal.reflect.GeneratedMethodAccessor51705.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163) at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:158) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:143) at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161) at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165) at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17) Caused: java.lang.IllegalArgumentException: Could not instantiate {text="COL1","COL2" "R1C1","R1C2" , format=Delimiter=<,> QuoteChar=<"> RecordSeparator=< > EmptyLines:ignored SkipHeaderRecord:false} for org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:334) at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:272) at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:205) at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:24) at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepDescriptorImpl.newInstance(AbstractFileOrTextStepDescriptorImpl.java:12) at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:299) at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:193) at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122) at jdk.internal.reflect.GeneratedMethodAccessor51705.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163) at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:158) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:143) at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161) at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165) at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17) at WorkflowScript.run(WorkflowScript:4) at ___cps.transform___(Native Method) at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:86) at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:113) at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83) at jdk.internal.reflect.GeneratedMethodAccessor230.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) 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 jdk.internal.reflect.GeneratedMethodAccessor272.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) 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 jdk.internal.reflect.GeneratedMethodAccessor242.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) 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.SandboxContinuable.access$001(SandboxContinuable.java:18) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51) at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:185) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:400) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:312) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:276) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)
            ksenia Ksenia Weiss added a comment -

            Hello,

            Same here for:

            Jenkins: 2.289.2

            Pipeline Utility Plugin: 2.8.0

             

            Reproduced:

            import org.apache.commons.csv.CSVFormat

            ...
            def data = readCSV file:filename, format:CSVFormat.DEFAULT.withHeader()
             
            Failure:
            org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep: 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]
             
             
            Any ETA for fix?

            ksenia Ksenia Weiss added a comment - Hello, Same here for: Jenkins: 2.289.2 Pipeline Utility Plugin: 2.8.0   Reproduced: import org.apache.commons.csv.CSVFormat ... def data = readCSV  file:filename , format:CSVFormat.DEFAULT.withHeader()   Failure: org.jenkinsci.plugins.pipeline.utility.steps.csv.ReadCSVStep: 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]     Any ETA for fix?

            Any ETA on this?

            sandipjee Sandip Mukherjee added a comment - Any ETA on this?
            sandipjee Sandip Mukherjee made changes -
            Priority Minor [ 4 ] Blocker [ 1 ]
            sbgerdp Gert Palok made changes -
            Link This issue is caused by JENKINS-66203 [ JENKINS-66203 ]
            markewaite Mark Waite made changes -
            Component/s pipeline-utility-steps-plugin [ 21135 ]
            Component/s pipeline-stage-step-plugin [ 21709 ]

            People

              Unassigned Unassigned
              fgeckeler Florian Geckeler
              Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated: