diff --git a/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java b/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java index 46c02402ed531..86a4f9afcd6a3 100644 --- a/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java +++ b/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java @@ -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; @@ -54,17 +51,13 @@ public PagedList(Page 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); } } @@ -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 nextPage(String nextPageLink) throws RestException, IOException; + public abstract Page nextPage(String nextPageLink); /** * If there are more pages available. diff --git a/azure-client-runtime/src/test/java/com/microsoft/azure/PagedListTests.java b/azure-client-runtime/src/test/java/com/microsoft/azure/PagedListTests.java index 04567aa1c6730..dfac45400504b 100644 --- a/azure-client-runtime/src/test/java/com/microsoft/azure/PagedListTests.java +++ b/azure-client-runtime/src/test/java/com/microsoft/azure/PagedListTests.java @@ -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; @@ -23,7 +22,7 @@ public class PagedListTests { public void setupList() { list = new PagedList(new TestPage(0, 21)) { @Override - public Page nextPage(String nextPageLink) throws CloudException, IOException { + public Page nextPage(String nextPageLink) { int pageNum = Integer.parseInt(nextPageLink); return new TestPage(pageNum, 21); }