本文整理匯總了Java中org.eclipse.egit.github.core.client.NoSuchPageException類的典型用法代碼示例。如果您正苦於以下問題:Java NoSuchPageException類的具體用法?Java NoSuchPageException怎麽用?Java NoSuchPageException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
NoSuchPageException類屬於org.eclipse.egit.github.core.client包,在下文中一共展示了NoSuchPageException類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPagedEtags
import org.eclipse.egit.github.core.client.NoSuchPageException; //導入依賴的package包/類
/**
* Gets a list of ETags for all pages returned from an API request and
* also return the connection used to get the ETags so that their last check time
* can be recorded elsewhere
*
* @param request
* @param client
* @return a Optional list of ETags for all pages returned from an API request and
* corresponding HTTP connection or an empty Optional if an error occurs
*/
private Optional<ImmutablePair<List<String>, HttpURLConnection>> getPagedEtags(
GitHubRequest request, GitHubClientEx client) {
PageHeaderIterator iter = new PageHeaderIterator(request, client, "ETag");
List<String> etags = new ArrayList<>();
HttpURLConnection connection = null;
while (iter.hasNext()) {
try {
etags.add(Utility.stripQuotes(iter.next()));
if (connection == null) {
connection = iter.getLastConnection();
}
} catch (NoSuchPageException e) {
logger.error("No such page exception at " + iter.getRequest().generateUri());
return Optional.empty();
}
}
return Optional.of(new ImmutablePair<>(etags, connection));
}
示例2: getPagedItems
import org.eclipse.egit.github.core.client.NoSuchPageException; //導入依賴的package包/類
/**
* A specialised version of GitHubService::getPage that does logging.
*
* @param iterator the paged request to iterate through
* @return a list of items
* @throws IOException
*/
protected List<T> getPagedItems(String resourceDesc, PageIterator<T> iterator) throws IOException {
List<T> elements = new ArrayList<>();
int length = 0;
int page = 0;
try {
while (iterator.hasNext()) {
elements.addAll(iterator.next());
int diff = elements.size() - length;
length = elements.size();
logger.info(resourceDesc + " | page " + (page++) + ": " + diff + " items");
}
} catch (NoSuchPageException pageException) {
throw pageException.getCause();
}
return elements;
}
示例3: getPagedItems
import org.eclipse.egit.github.core.client.NoSuchPageException; //導入依賴的package包/類
/**
* Overrides parent's method to stop getting items if some items in a page has
* updatedAt time before the lastIssueCheckTime
*
* @param resourceDesc
* @param iterator the paged request to iterate through
* @return
* @throws IOException
*/
@Override
protected List<PullRequest> getPagedItems(String resourceDesc, PageIterator<PullRequest> iterator)
throws IOException {
List<PullRequest> elements = new ArrayList<>();
int page = 0;
try {
while (iterator.hasNext()) {
Collection<PullRequest> newPullRequests = iterator.next();
int numAddedItems = addItemsUpdatedSince(elements, newPullRequests, lastIssueCheckTime);
logger.info(resourceDesc + " | page " + (page++) + ": " + numAddedItems + " items");
if (numAddedItems < newPullRequests.size()) {
break;
}
}
} catch (NoSuchPageException pageException) {
throw pageException.getCause();
}
return elements;
}
示例4: next
import org.eclipse.egit.github.core.client.NoSuchPageException; //導入依賴的package包/類
/**
* Get the next page of issues
*
* @return true if more pages
* @throws java.io.IOException
*/
public boolean next() throws IOException {
boolean emptyPage = false;
PageIterator<E> iterator = createIterator(page, -1);
try {
for (int i = 0; i < count && iterator.hasNext(); i++) {
Collection<E> resourcePage = iterator.next();
emptyPage = resourcePage.isEmpty();
if (emptyPage)
break;
for (E resource : resourcePage) {
resource = register(resource);
if (resource == null)
continue;
resources.put(getId(resource), resource);
}
}
// Set page to count value if first call after call to reset()
if (count > 1) {
page = count;
count = 1;
}
page++;
} catch (NoSuchPageException e) {
hasMore = false;
throw e.getCause();
}
hasMore = iterator.hasNext() && !emptyPage;
return hasMore;
}
示例5: getAll
import org.eclipse.egit.github.core.client.NoSuchPageException; //導入依賴的package包/類
/**
* Get paged request by performing multiple requests until no more pages are
* available or an exception occurs.
*
* @param <V>
* @param iterator
* @return list of all elements
* @throws IOException
*/
protected <V> List<V> getAll(PageIterator<V> iterator) throws IOException {
List<V> elements = new ArrayList<V>();
try {
while (iterator.hasNext())
elements.addAll(iterator.next());
} catch (NoSuchPageException pageException) {
throw pageException.getCause();
}
return elements;
}