-
Bug
-
Resolution: Fixed
-
Major
-
None
-
Jenkins 2.204.2
fixed in 2.242
-
-
Jenkins 2.242
I'm had implement a jenkins.branch.BranchProperty that list all available ParameterDefinition.
It normally works but when I select a ChoiceParameter I got the following Exception on save:
java.lang.IllegalArgumentException: Unable to convert to class java.lang.Object at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:738) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:478) at org.kohsuke.stapler.RequestImpl.injectSetters(RequestImpl.java:834) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:784) at org.kohsuke.stapler.RequestImpl.access$200(RequestImpl.java:83) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:678) Caused: java.lang.IllegalArgumentException: Failed to instantiate class hudson.model.ParameterDefinition from {"name":"SCENARIO","choices":"1\n2\n3","description":"","":"","stapler-class":"hudson.model.ChoiceParameterDefinition","$class":"hudson.model.ChoiceParameterDefinition"} at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:681) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:717) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:478) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:778) Caused: java.lang.IllegalArgumentException: Failed to convert the parameterDefinitions parameter of the constructor public com.thedigitalstack.jenkins.plugins.parametricrun.ParameterBranchProperty(java.lang.String,boolean,java.lang.String,java.util.List) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:780) at org.kohsuke.stapler.RequestImpl.access$200(RequestImpl.java:83) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:678) Caused: java.lang.IllegalArgumentException: Failed to instantiate class jenkins.branch.BranchProperty from {"actionLabel":"Action Label","useBadge":false,"badgeTemplate":"Run with #$PARAMETER","parameterDefinitions":{"name":"SCENARIO","choices":"1\n2\n3","description":"","":"","stapler-class":"hudson.model.ChoiceParameterDefinition","$class":"hudson.model.ChoiceParameterDefinition"},"stapler-class":"com.thedigitalstack.jenkins.plugins.parametricrun.ParameterBranchProperty","$class":"com.thedigitalstack.jenkins.plugins.parametricrun.ParameterBranchProperty"} ...
The RequestImpl instantiate a ChoiceParameterDefinition class and than using reflection lookup a setter @DataBoundSetter annotated for "choice" property. It takes the parameter type from method (in this unlikely case Object) and than use apache beanutils to convert the actual value "v1\n2\n3" (String) to Object. Since there are no converter registered for Object it fails.
- is caused by
-
JENKINS-26143 Workflow Snippet Generator - Incorrect format for Input with Choice Parameter
-
- Resolved
-
- relates to
-
JENKINS-26143 Workflow Snippet Generator - Incorrect format for Input with Choice Parameter
-
- Resolved
-
- links to
[JENKINS-63015] IllegalArgumentException for ChoiceParameter on bindJSON saving job configuration
Attachment | New: payload.json [ 50648 ] |
Description |
Original:
I'm had implement a jenkins.branch.BranchProperty that list all available ParameterDefinition. !image-2020-03-11-17-00-27-616.png|thumbnail! It normally works but when I select a ChoiceParameter I got the following Exception on save: {noformat} java.lang.IllegalArgumentException: Unable to convert to class java.lang.Object at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:738) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:478) at org.kohsuke.stapler.RequestImpl.injectSetters(RequestImpl.java:834) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:784) at org.kohsuke.stapler.RequestImpl.access$200(RequestImpl.java:83) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:678) Caused: java.lang.IllegalArgumentException: Failed to instantiate class hudson.model.ParameterDefinition from {"name":"SCENARIO","choices":"1\n2\n3","description":"","":"","stapler-class":"hudson.model.ChoiceParameterDefinition","$class":"hudson.model.ChoiceParameterDefinition"} at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:681) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:717) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:478) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:778) Caused: java.lang.IllegalArgumentException: Failed to convert the parameterDefinitions parameter of the constructor public com.thedigitalstack.jenkins.plugins.parametricrun.ParameterBranchProperty(java.lang.String,boolean,java.lang.String,java.util.List) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:780) at org.kohsuke.stapler.RequestImpl.access$200(RequestImpl.java:83) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:678) Caused: java.lang.IllegalArgumentException: Failed to instantiate class jenkins.branch.BranchProperty from {"actionLabel":"Action Label","useBadge":false,"badgeTemplate":"Run with #$PARAMETER","parameterDefinitions":{"name":"SCENARIO","choices":"1\n2\n3","description":"","":"","stapler-class":"hudson.model.ChoiceParameterDefinition","$class":"hudson.model.ChoiceParameterDefinition"},"stapler-class":"com.thedigitalstack.jenkins.plugins.parametricrun.ParameterBranchProperty","$class":"com.thedigitalstack.jenkins.plugins.parametricrun.ParameterBranchProperty"} ... {noformat} The RequestImpl instantiate a ChoiceParameterDefinition and than using reflection lookup a setter {{@DataBoundSetter}} annotated for "choice" property. It takes the method parameter type (in case unlike case Object) and than use apache beanutil to convert the actual value "v1\n2\n3" (String) to Object. There are no converter registere for Object and it fails on [RequestImpl.java|https://github.com/stapler/stapler/blob/c8c28eb749937ab239d7b7f94c2254340103f67e/core/src/main/java/org/kohsuke/stapler/RequestImpl.java#L736] |
New:
I'm had implement a jenkins.branch.BranchProperty that list all available ParameterDefinition. !image-2020-03-11-17-00-27-616.png|thumbnail! It normally works but when I select a ChoiceParameter I got the following Exception on save: {noformat} java.lang.IllegalArgumentException: Unable to convert to class java.lang.Object at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:738) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:478) at org.kohsuke.stapler.RequestImpl.injectSetters(RequestImpl.java:834) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:784) at org.kohsuke.stapler.RequestImpl.access$200(RequestImpl.java:83) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:678) Caused: java.lang.IllegalArgumentException: Failed to instantiate class hudson.model.ParameterDefinition from {"name":"SCENARIO","choices":"1\n2\n3","description":"","":"","stapler-class":"hudson.model.ChoiceParameterDefinition","$class":"hudson.model.ChoiceParameterDefinition"} at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:681) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:717) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:478) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:778) Caused: java.lang.IllegalArgumentException: Failed to convert the parameterDefinitions parameter of the constructor public com.thedigitalstack.jenkins.plugins.parametricrun.ParameterBranchProperty(java.lang.String,boolean,java.lang.String,java.util.List) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:780) at org.kohsuke.stapler.RequestImpl.access$200(RequestImpl.java:83) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:678) Caused: java.lang.IllegalArgumentException: Failed to instantiate class jenkins.branch.BranchProperty from {"actionLabel":"Action Label","useBadge":false,"badgeTemplate":"Run with #$PARAMETER","parameterDefinitions":{"name":"SCENARIO","choices":"1\n2\n3","description":"","":"","stapler-class":"hudson.model.ChoiceParameterDefinition","$class":"hudson.model.ChoiceParameterDefinition"},"stapler-class":"com.thedigitalstack.jenkins.plugins.parametricrun.ParameterBranchProperty","$class":"com.thedigitalstack.jenkins.plugins.parametricrun.ParameterBranchProperty"} ... {noformat} The RequestImpl instantiate a ChoiceParameterDefinition class and than using reflection lookup a setter @DataBoundSetter annotated for "choice" property. It takes the parameter type from method (in this unlikely case Object) and than use apache beanutils to convert the actual value "v1\n2\n3" (String) to Object. Since there are no converter registered for Object it fails. |
Assignee | New: Nikolas Falco [ nfalco ] |
Status | Original: Open [ 1 ] | New: In Progress [ 3 ] |
Priority | Original: Minor [ 4 ] | New: Major [ 3 ] |
Remote Link | New: This issue links to "PR (Web Link)" [ 24725 ] |
Link |
New:
This issue relates to |
Link |
New:
This issue is caused by |
Environment | Original: Jenkins 2.204.2 |
New:
Jenkins 2.204.2 fixed in 2.242 |
Released As | New: Jenkins 2.242 | |
Resolution | New: Fixed [ 1 ] | |
Status | Original: In Progress [ 3 ] | New: Resolved [ 5 ] |