Skip to content

Commit

Permalink
Remove throws on many methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jianghaolu committed Sep 15, 2016
1 parent 26d2c0a commit 0eb2adc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

package com.microsoft.azure;

import com.microsoft.rest.RestException;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
Expand Down Expand Up @@ -54,17 +51,13 @@ public PagedList(Page<E> page) {
}

private void cachePage(String nextPageLink) {
try {
while (nextPageLink != null) {
cachedPage = nextPage(nextPageLink);
nextPageLink = cachedPage.getNextPageLink();
if (hasNextPage()) {
// a legit, non-empty page has been fetched, otherwise keep fetching
break;
}
while (nextPageLink != null) {
cachedPage = nextPage(nextPageLink);
nextPageLink = cachedPage.getNextPageLink();
if (hasNextPage()) {
// a legit, non-empty page has been fetched, otherwise keep fetching
break;
}
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}

Expand All @@ -73,10 +66,8 @@ private void cachePage(String nextPageLink) {
*
* @param nextPageLink the link to get the next page of items.
* @return the {@link Page} object storing a page of items and a link to the next page.
* @throws RestException thrown if an error is raised from Azure.
* @throws IOException thrown if there's any failure in deserialization.
*/
public abstract Page<E> nextPage(String nextPageLink) throws RestException, IOException;
public abstract Page<E> nextPage(String nextPageLink);

/**
* If there are more pages available.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.junit.Before;
import org.junit.Test;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand All @@ -23,7 +22,7 @@ public class PagedListTests {
public void setupList() {
list = new PagedList<Integer>(new TestPage(0, 21)) {
@Override
public Page<Integer> nextPage(String nextPageLink) throws CloudException, IOException {
public Page<Integer> nextPage(String nextPageLink) {
int pageNum = Integer.parseInt(nextPageLink);
return new TestPage(pageNum, 21);
}
Expand Down

0 comments on commit 0eb2adc

Please sign in to comment.