Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] java.lang.Integer cannot be cast to class java.lang.String #109

Closed
augustocarvalho opened this issue Jan 17, 2022 · 7 comments · Fixed by #114
Closed

[BUG] java.lang.Integer cannot be cast to class java.lang.String #109

augustocarvalho opened this issue Jan 17, 2022 · 7 comments · Fixed by #114
Labels
bug Something isn't working

Comments

@augustocarvalho
Copy link

In Jenkins we have jobs with REST List Parameter enabled and it uses our Docker Tags as REST endpoint:
Ex:
REST Endpoint: https://REPO_URL/v2/hello-world/tags/list
MIME type: APPLICATION JSON
Value Expression: $.tags
image

When manually curl the address we have as result:
{
"name" : "hello-world",
"tags" : [ "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "3", "4", "6", "7", "8", "9" ]
}

Versions (please complete the following information):

  • Jenkins: 2.319.2
  • Plugin: 1.5.0
  • Browser: Firefox or Chrome

Additional context
JENKINS ERROR:

Error while serving http://JOB_URL/descriptorByName/io.jenkins.plugins.restlistparam.RestListParameterDefinition/testConfiguration
java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.String (java.lang.Integer and java.lang.String are in module java.base of loader 'bootstrap')

Caused: java.lang.reflect.InvocationTargetException
at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:397)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:405)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:208)

There is other Job that it works and the JSON result is:
{
"name" : "image_name",
"tags" : [ "1.0.0-20210211101025", "1.0.0-20210211101625", "1.0.0-20210211101756", "1.0.0-20210211102118", "1.0.0-20210305142411", "1.0.0-20210309074905", "1.0.0-20210310065345", "1.0.0-20210312074331", "1.0.0-20210319065144", "1.0.0-20210324142526", "1.0.0-20210330073431", "1.0.0-20210426065757", "1.0.0-20210519113253", "1.0.0-49", "1.0.0-52", "1.0.0-53", "1.0.0-54", "1.0.0-latest" ]
}

@augustocarvalho augustocarvalho added the bug Something isn't working label Jan 17, 2022
@h1dden-da3m0n
Copy link
Contributor

Hello there,

Thank you for the bug report! I will see that I can reproduce this and provide a fix soon.
I just hope its not a Json Parser issue, cause there I am dependent on the library I use.

@augustocarvalho
Copy link
Author

Hi, any news on this ?! Thanks/

@h1dden-da3m0n
Copy link
Contributor

Hi,
unfortunately not yet. I intended to get working on this but got quite busy at work and eventually it fell through. I will try to get on debugging latest this weekend and keep you posted!
Thank you for bringing it back to my attention!

@h1dden-da3m0n
Copy link
Contributor

Hi again,

Had some time today and managed to reproduce this.
Thanks to your awesome fault description with value examples it was easy to have a reproducible test environment, so a big thank you for that!

Now, I managed to find the fault in my code and have a local fix ready that I will publish soon. Arguably, it is a very trivial fix that I am annoyed I did not see earlier 🤦‍♂️ so thank you for reporting it back!

@h1dden-da3m0n
Copy link
Contributor

I will release 1.5.1 with the fix for this the moment the JenkinsCI Jenkins instance manages to successfully build again, seems like there is something funky going on rn ☹️

@h1dden-da3m0n
Copy link
Contributor

well I risked and simply cut the release. rest-list-parameter-1.5.1

Thank you for your patients and reporting this 👍

@augustocarvalho
Copy link
Author

It works, I appreciate your time looking at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants