Getting events for an issue is broken for all events with ID > 2147483647
- Dominant language
- Java
- Stars
- 307
- Forks
- 144
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 14
Description
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:
```java
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:
```bash
curl -H "Authorization: token MYTOKEN" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/MY_ORG/MY_REPO/issues/3131/events
```
```json
[
{
"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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.