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 SearchIssue id can be bigger than Integer.MAX #180

Conversation

vootelerotov
Copy link
Contributor

Represent it as Long instead of Integer.

For schema (where id is specified as 'int64') see:

https://docs.github.com/en/rest/search/search?apiVersion=2022-11-28#search-issues-and-pull-requests

@vootelerotov
Copy link
Contributor Author

Ran into this in the wild.

@vootelerotov
Copy link
Contributor Author

Hmm, build is failing with Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 65 -- not sure if this is related to my change-set?

@vootelerotov
Copy link
Contributor Author

It seems that a lot of PR-s now have ID-s that are bigger than Integer.MAX, quite easy to run into this in wild now.

@weidongxu-microsoft
Copy link

weidongxu-microsoft commented Jun 25, 2024

Comment ID could have the same integer overflow. e.g.
https://api.github.com/repos/Azure/azure-sdk-for-java/issues/comments/2188169837

It maybe safer to convert all ID of int type to long type.

@neeme-praks-sympower
Copy link

Also ran into this.

@sheepdreamofandroids
Copy link

Yep, had the same problem.
This should be merged because the problem is only going to be more frequent.

Copy link
Member

@Abhi347 Abhi347 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vootelerotov The PR is good to go if you add the test json file. Please ping me once you have done so.
Thanks for your contribution

@Test
public void testDeserializationWithLargeIssueId() throws IOException {
final String fixture =
Resources.toString(getResource(this.getClass(), "issues-with-large-id.json"), defaultCharset());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you forgot to add the issues-with-large-id.json file in the test resources. It needs to be added at src/test/resources/com/spotify/github/v3/issues/issues-with-large-id.json for this PR to pass.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh :(

@Abhi347 I think #200 is a more complete solution with passing tests (thanks @sindunuragarp), happy to close this PR in favour of it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Abhi347 Would be great if one of the two PRs could be merged :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge #200 Closing this now. Thanks for your contribution.

@Abhi347
Copy link
Member

Abhi347 commented Mar 10, 2025

Closing this as another PR (#200) fixing this issue is merged

@Abhi347 Abhi347 closed this Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants