When trying to get comments for pull requests with no comments NoSuchElementException is thrown.
I would except empty list instead.
java.util.NoSuchElementException
at org.kohsuke.github.Requester$1.next(Requester.java:212)
at org.kohsuke.github.PagedIterator.fetch(PagedIterator.java:42)
at org.kohsuke.github.PagedIterator.nextPage(PagedIterator.java:57)
at org.kohsuke.github.PagedIterable.asList(PagedIterable.java:20)
at org.kohsuke.github.GHIssue.getComments(GHIssue.java:184)
API response for /repos/janinko/test/issues/7/comments with no comments - there are no Link header and returns empty array:
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 10 Sep 2012 12:11:37 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Status: 200 OK
Cache-Control: max-age=0, private, must-revalidate
X-Content-Type-Options: nosniff
ETag: "a00049ba79152d03380c34652f2cb612"
Content-Length: 5
X-RateLimit-Limit: 5000
X-GitHub-Media-Type: github.beta
X-RateLimit-Remaining: 4957
[
]
So IMHO in PagedIterable.asList() i.hasNext() returns true because it has next (but empty) array.
When trying to get comments for pull requests with no comments
NoSuchElementExceptionis thrown.I would except empty list instead.
API response for
/repos/janinko/test/issues/7/commentswith no comments - there are noLinkheader and returns empty array:So IMHO in
PagedIterable.asList()i.hasNext()returns true because it has next (but empty) array.