diff --git a/README.md b/README.md index d21dda57d534bee676c1c4f2d4492257cee1b62a..b68588bc2e5c877ecd6220e8a85d686daa18b8d1 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ To utilize GitLab4J™ API in your Java project, simply add the following de ```java dependencies { ... - compile group: 'org.gitlab4j', name: 'gitlab4j-api', version: '4.10.12' + compile group: 'org.gitlab4j', name: 'gitlab4j-api', version: '4.10.14' } ``` @@ -23,7 +23,7 @@ dependencies { org.gitlab4j gitlab4j-api - 4.10.12 + 4.10.14 ``` diff --git a/pom.xml b/pom.xml index 3a51c5baa235b31983b240964c3a43cfec1b5f46..fe21923732febb3c88cf9e61aebe05a0e25311d8 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.gitlab4j gitlab4j-api jar - 4.10.13-SNAPSHOT + 4.10.14-SNAPSHOT GitLab4J-API - GitLab API Java Client GitLab4J-API (gitlab4j-api) provides a full featured Java client library for working with GitLab repositories and servers via the GitLab REST API. https://github.com/gitlab4j/gitlab4j-api diff --git a/src/main/java/org/gitlab4j/api/Pager.java b/src/main/java/org/gitlab4j/api/Pager.java index 8abf7d9a8a657a63feca7f2013af6f51614846b4..a0c608e515f9b32c5d0277d008a8c47b368e4732 100644 --- a/src/main/java/org/gitlab4j/api/Pager.java +++ b/src/main/java/org/gitlab4j/api/Pager.java @@ -343,17 +343,17 @@ public class Pager implements Iterator>, Constants { */ public List all() throws GitLabApiException { - // Make sure that current page is 0, this will ensure the whole list is fetched - // regardless of what page the instance is currently on. - currentPage = 0; - List allItems = new ArrayList<>(totalItems); - - // Iterate through the pages and append each page of items to the list - while (hasNext()) { - allItems.addAll(next()); - } + // Make sure that current page is 0, this will ensure the whole list is fetched + // regardless of what page the instance is currently on. + currentPage = 0; + List allItems = new ArrayList<>(Math.max(totalItems, 0)); + + // Iterate through the pages and append each page of items to the list + while (hasNext()) { + allItems.addAll(next()); + } - return (allItems); + return (allItems); } /**