if (searchResults.getReturnedCount() == 0) {
throw new ResourceNotInArchiveException(wbRequest.getRequestUrl() + " was not found");
}
} catch (IOException e) {
throw new ResourceIndexNotAvailableException(e.toString());
} catch (RuntimeException rte) {
Throwable cause = rte.getCause();
if (cause instanceof AccessControlException) {
throw (AccessControlException)cause;
}
if (cause instanceof IOException) {
throw new ResourceIndexNotAvailableException(cause.toString());
}
rte.printStackTrace(); // for now, for better debugging
throw new ResourceIndexNotAvailableException(rte.toString());
}
return searchResults;
}