[JIRA] (JENKINS-58137) readCSV fails when passing CSVFormat

20 views
Skip to first unread message

f.geckeler@sap.com (JIRA)

unread,
Jun 21, 2019, 4:48:02 AM6/21/19
to jenkinsc...@googlegroups.com
Florian Geckeler created an issue
 
Jenkins / Bug JENKINS-58137
readCSV fails when passing CSVFormat
Issue Type: Bug Bug
Assignee: Unassigned
Components: pipeline-stage-step-plugin
Created: 2019-06-21 08:47
Environment: plain sandbox pipeline, jenkins-filerunner
Labels: pipeline plugin step readCSV
Priority: Minor Minor
Reporter: Florian Geckeler

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:

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 UTCREST API[Jenkins ver. 2.164.3|https://jenkins.io/]

 

 

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 }
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

f.geckeler@sap.com (JIRA)

unread,
Jun 21, 2019, 4:49:17 AM6/21/19
to jenkinsc...@googlegroups.com
Florian Geckeler updated an issue
Change By: Florian Geckeler
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 :///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)
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='1003764')\", \"hystrix-.addressmgr.commands.GetSingleBusinessPartnerByIdCommand#t=#u=-1\""
 
def rec = readCSV text: csv, format: CSVFormat.DEFAULT
}

f.geckeler@sap.com (JIRA)

unread,
Jun 21, 2019, 4:49:22 AM6/21/19
to jenkinsc...@googlegroups.com

f.geckeler@sap.com (JIRA)

unread,
Jun 21, 2019, 4:50:02 AM6/21/19
to jenkinsc...@googlegroups.com
}}
{{ 
def rec = readCSV text: csv, format: CSVFormat.DEFAULT }}
{{}}}

f.geckeler@sap.com (JIRA)

unread,
Jun 21, 2019, 4:52:05 AM6/21/19
to jenkinsc...@googlegroups.com
Florian Geckeler updated an issue
Hi,

 

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

f.geckeler@sap.com (JIRA)

unread,
Jun 21, 2019, 4:52:05 AM6/21/19
to jenkinsc...@googlegroups.com
Florian Geckeler updated an issue
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/]].

f.geckeler@sap.com (JIRA)

unread,
Jun 21, 2019, 5:11:02 AM6/21/19
to jenkinsc...@googlegroups.com
Florian Geckeler updated an issue
Hi,

 

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

 

f.geckeler@sap.com (JIRA)

unread,
Jun 21, 2019, 5:13:03 AM6/21/19
to jenkinsc...@googlegroups.com
Florian Geckeler updated an issue
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) }}
{{   }}
{{   }}

f.geckeler@sap.com (JIRA)

unread,
Jun 21, 2019, 5:13:04 AM6/21/19
to jenkinsc...@googlegroups.com
Florian Geckeler updated an issue
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]:

{{   }}
ava {{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 }}

f.geckeler@sap.com (JIRA)

unread,
Jun 21, 2019, 5:13:06 AM6/21/19
to jenkinsc...@googlegroups.com
Florian Geckeler updated an issue
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}}
{{}}}

 

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 [1] :
{quote}java
 
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

Unknown macro: \
{text="[http } :///opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner='1003764|http://opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner(BusinessPartner=]
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:

 

 

f.geckeler@sap.com (JIRA)

unread,
Jun 21, 2019, 5:14:17 AM6/21/19
to jenkinsc...@googlegroups.com
Florian Geckeler updated an issue
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='1003764')\", \"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='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 __cps . transform___ transform__ (Native Method)

{code}
 

jakub@pawlinski.pl (JIRA)

unread,
Sep 5, 2019, 10:42:04 AM9/5/19
to jenkinsc...@googlegroups.com
Jakub Pawlinski commented on Bug JENKINS-58137
 
Re: readCSV fails when passing CSVFormat

add at the top of your class/file

import org.apache.commons.csv.CSVFormat
Reply all
Reply to author
Forward
0 new messages