Skip to content

Commit

Permalink
Merge pull request #713 from gitlab4j/issue-658
Browse files Browse the repository at this point in the history
Fix #658 : Pager not working properly
  • Loading branch information
jabby committed Jun 7, 2021
2 parents db8f925 + 4e9f7a6 commit 69c15a3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/org/gitlab4j/api/Pager.java
Expand Up @@ -306,12 +306,6 @@ public List<T> current() throws GitLabApiException {
*/
public List<T> page(int pageNumber) {

if (pageNumber > totalPages && pageNumber > kaminariNextPage) {
throw new NoSuchElementException();
} else if (pageNumber < 1) {
throw new NoSuchElementException();
}

if (currentPage == 0 && pageNumber == 1) {
currentPage = 1;
return (currentItems);
Expand All @@ -321,6 +315,12 @@ public List<T> page(int pageNumber) {
return (currentItems);
}

if (pageNumber > totalPages && pageNumber > kaminariNextPage) {
throw new NoSuchElementException();
} else if (pageNumber < 1) {
throw new NoSuchElementException();
}

try {

setPageParam(pageNumber);
Expand Down

0 comments on commit 69c15a3

Please sign in to comment.