Getting events for an issue is broken for all events with ID > 2147483647
I use jcabi-github 1.1.2. I want to get (fetch) all events for an issue in my repo. I use code similar to this:
Issue issue = repo.issues().get(3131);
for (Event next : issue.events()) {
System.out.println(next.json().toString());
}
Unfortunately, it fails with the following response from GH API:
{"message":"Not Found","documentation_url":"https://docs.github.com/rest/reference/issues#get-an-issue-event"} Expected: HTTP response with status 200 but: was <404 Not Found [https://api.github.com/repos/MY_ORG/MY_REPO/issues/events/-1175196180]
Please note the negative number in URL above.
Getting events from command line works fine:
curl -H "Authorization: token MYTOKEN" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/MY_ORG/MY_REPO/issues/3131/events
[
{
"id": 3119771116,
"node_id": "MDEyOkxhYmVsZWRFdmVudDMxMTk3NzExMTY=",
"url": "https://api.github.com/repos/MY_ORG/MY_REPO/issues/events/3119771116"
...
}
]
As you can see, event ID in this case is 3119771116 which is greater than Integer.MAX_VALUE (i.e. 2147483647), thus causing integer overflow. I believe that by altering RtEvent class so that it uses private final transient long num; instead of private final transient int num; the problem would be solved.
@TheJavaGuy Right, that's probably the issue. Can you please make a Pull Request? There aren't any contributors actively working on this repo at the moment, unfortunately.
@amihaiemil Sure, I'll make it soon.