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

DescribableHelper error with @DataBoundSetter on Map<String,String>



    • Type: Bug
    • Status: Reopened (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: structs-plugin
    • Labels:
    • Environment:
      Jenkins 1.609
      workflow-plugin 1.6
    • Similar Issues:


      I'm working on implementing a new step in a plugin, and came across the following error:
      If one argument step is a Map, and it is a field annotated with @DataBoundSetter, Ok, no problems. But if it is a Setter annotated with @DataBoundSetter the following error occurs during instantiation:

      java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class
      	at org.jenkinsci.plugins.workflow.structs.DescribableHelper.coerce(DescribableHelper.java:214)
      	at org.jenkinsci.plugins.workflow.structs.DescribableHelper.buildArguments(DescribableHelper.java:186)
      	at org.jenkinsci.plugins.workflow.structs.DescribableHelper.injectSetters(DescribableHelper.java:308)
      	at org.jenkinsci.plugins.workflow.structs.DescribableHelper.instantiate(DescribableHelper.java:93)
      	at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:95)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:133)
      	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:100)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
      	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15)
      	at WorkflowScript.run(WorkflowScript:5)

      Apparently the error is in injectSetters() method of the class DescribableHelper


          Issue Links


            valones Flávio Augusto Valones created issue -
            jglick Jesse Glick made changes -
            Field Original Value New Value
            Link This issue duplicates JENKINS-26535 [ JENKINS-26535 ]
            jglick Jesse Glick made changes -
            Resolution Duplicate [ 3 ]
            Status Open [ 1 ] Resolved [ 5 ]
            jglick Jesse Glick made changes -
            Resolution Duplicate [ 3 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            jglick Jesse Glick made changes -
            Summary Reflection Error Defining Step Param DescribableHelper error with @DataBoundSetter on Map<String,String>
            jglick Jesse Glick made changes -
            Link This issue is blocking JENKINS-30519 [ JENKINS-30519 ]
            jglick Jesse Glick made changes -
            Epic Link JENKINS-35393 [ 171186 ]
            jglick Jesse Glick made changes -
            Component/s structs-plugin [ 21442 ]
            Component/s workflow-plugin [ 18820 ]
            Labels plugin step workflow workflow
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 163351 ] JNJira + In-Review [ 186287 ]
            abayer Andrew Bayer made changes -
            Labels workflow pipeline workflow
            abayer Andrew Bayer made changes -
            Labels pipeline workflow pipeline


              jglick Jesse Glick
              valones Flávio Augusto Valones
              1 Vote for this issue
              3 Start watching this issue