Unverified Commit ae1af6cf authored by Greg Messner's avatar Greg Messner Committed by GitHub
Browse files

Bug - Fixed issue with Pager when GitLab returns -1 for total-items. (#347)

* Fixed issue caused by the GitLab server returning -1 for total items (#346).
parent 59107379
Showing with 13 additions and 13 deletions
+13 -13
......@@ -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 {
<dependency>
<groupId>org.gitlab4j</groupId>
<artifactId>gitlab4j-api</artifactId>
<version>4.10.12</version>
<version>4.10.14</version>
</dependency>
```
......
......@@ -5,7 +5,7 @@
<groupId>org.gitlab4j</groupId>
<artifactId>gitlab4j-api</artifactId>
<packaging>jar</packaging>
<version>4.10.13-SNAPSHOT</version>
<version>4.10.14-SNAPSHOT</version>
<name>GitLab4J-API - GitLab API Java Client</name>
<description>GitLab4J-API (gitlab4j-api) provides a full featured Java client library for working with GitLab repositories and servers via the GitLab REST API.</description>
<url>https://github.com/gitlab4j/gitlab4j-api</url>
......
......@@ -343,17 +343,17 @@ public class Pager<T> implements Iterator<List<T>>, Constants {
*/
public List<T> 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<T> 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<T> 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);
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment