|
6 | 6 | import org.jetbrains.annotations.NotNull; |
7 | 7 |
|
8 | 8 | import java.io.IOException; |
9 | | -import java.net.MalformedURLException; |
10 | 9 | import java.net.URL; |
11 | 10 | import java.util.Collections; |
12 | 11 | import java.util.Iterator; |
@@ -362,23 +361,19 @@ public GHCompareCommitsIterable() { |
362 | 361 | @Nonnull |
363 | 362 | @Override |
364 | 363 | public PagedIterator<Commit> _iterator(int pageSize) { |
365 | | - try { |
366 | | - GitHubRequest request = owner.root() |
367 | | - .createRequest() |
368 | | - .injectMappingValue("GHCompare_usePaginatedCommits", usePaginatedCommits) |
369 | | - .withUrlPath(owner.getApiTailUrl(url.substring(url.lastIndexOf("/compare/")))) |
370 | | - .build(); |
371 | | - |
372 | | - // page_size must be set for GHCompare commit pagination |
373 | | - if (pageSize == 0) { |
374 | | - pageSize = 10; |
375 | | - } |
376 | | - return new PagedIterator<>( |
377 | | - adapt(GitHubPageIterator.create(owner.root().getClient(), GHCompare.class, request, pageSize)), |
378 | | - item -> item.wrapUp(owner)); |
379 | | - } catch (MalformedURLException e) { |
380 | | - throw new GHException("Malformed URL", e); |
| 364 | + GitHubRequest request = owner.root() |
| 365 | + .createRequest() |
| 366 | + .injectMappingValue("GHCompare_usePaginatedCommits", usePaginatedCommits) |
| 367 | + .withUrlPath(owner.getApiTailUrl(url.substring(url.lastIndexOf("/compare/")))) |
| 368 | + .build(); |
| 369 | + |
| 370 | + // page_size must be set for GHCompare commit pagination |
| 371 | + if (pageSize == 0) { |
| 372 | + pageSize = 10; |
381 | 373 | } |
| 374 | + return new PagedIterator<>( |
| 375 | + adapt(GitHubPageIterator.create(owner.root().getClient(), GHCompare.class, request, pageSize)), |
| 376 | + item -> item.wrapUp(owner)); |
382 | 377 | } |
383 | 378 |
|
384 | 379 | protected Iterator<Commit[]> adapt(final Iterator<GHCompare> base) { |
|
0 commit comments