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

Queue ID is returning from Jenkins as a Long value, not an Integer as expected by the jenkins-rest API #315

Open
whiskaz opened this issue Oct 24, 2023 · 1 comment
Assignees

Comments

@whiskaz
Copy link

whiskaz commented Oct 24, 2023

Expected Behavior

The Jenkins environment I run against recently received an update which resulted in the queue IDs returning as random long values instead of sequential integers. As a result, calls to jobsApi().buildWithParameters and attempting to retrieve the queue ID will fail/return null.

Example: url=queue/item/1424517224752202436/

Current Behavior

As a result of the queue ID being returned as a long value, the jenkins-rest api fails (no queue id is returned and attempting to access it results in an error from the json processor).

23-Oct-2023 11:04:37 | Caused by: java.lang.NumberFormatException: Expected an int but was 325127458841757426 at line 1 column 951 path $.items[0].id
23-Oct-2023 11:04:37 | at io.github.cdancy.jenkins.rest.shaded.com.google.gson.stream.JsonReader.nextInt(JsonReader.java:1171) ~[jenkins-rest-1.0.2-all.jar!/:1.0.2]
...snip...
23-Oct-2023 11:04:37 | at io.github.cdancy.jenkins.rest.shaded.com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:86) ~[jenkins-rest-1.0.2-all.jar!/:1.0.2]
23-Oct-2023 11:04:37 | at com.sun.proxy.$Proxy107.queue(Unknown Source) ~[na:na]

Steps to Reproduce (for bugs)

I don't have any insight into how the Jenkins environment I'm running against is configured and I can't control how the queue IDs are returned. Looking at the official API, it appears the queue ID is expected to be a long:

https://javadoc.jenkins-ci.org/hudson/model/Queue.Item.html#getId()

Your Environment

Jenkins version 2.414.2

@cdancy
Copy link
Owner

cdancy commented Oct 24, 2023

Interesting ... looks like the number is too big for an int. Should be an easy enough fix if @whiskaz you want to send in a fix for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants