public boolean hasNoExceptions() { boolean isEmpty = true; for (ReturnWithExceptions<?, ?> item : list) { isEmpty = isEmpty && item.getExceptions().isEmpty(); } return isEmpty; }
public static MultipleGenericException build(List<ReturnWithExceptions<?, ?>> list) { List<Exception> causes = new ArrayList<>(); for (ReturnWithExceptions<?, ?> item : list) { for (Exception e : item.getExceptions()) { causes.add(e); } } return new MultipleGenericException(causes); }
public void add(ReturnWithExceptions<?, S> ts) { add(ts.getExceptions()); }
public void failOnError() throws GenericException { if (!hasNoExceptions()) { if (list.size() == 1 && list.get(0).getExceptions().size() == 1) { // if there is one and only one exception throw it throw new GenericException(list.get(0).getExceptions().get(0)); } else { LOGGER.error(printStackTraces()); throw MultipleGenericException.build(list); } } } }
private ReturnWithExceptions<Void, ModelObserver> indexAIP(final AIP aip, final List<String> ancestors, boolean safemode) { ReturnWithExceptions<Void, ModelObserver> ret = new ReturnWithExceptions<>(this); SolrUtils.create2(index, (ModelObserver) this, IndexedAIP.class, aip, new AIPCollection.Info(ancestors, safemode)) .addTo(ret); // if there was an error indexing, try in safe mode if (!ret.isEmpty()) { if (!safemode) { LOGGER.error("Error indexing AIP, trying safe mode", ret.getExceptions().get(0)); indexAIP(aip, ancestors, true).addTo(ret); } else { LOGGER.error("Cannot index created AIP", ret.getExceptions().get(0)); } } return ret; }
List<Exception> exceptionList = exceptions.getExceptions(); if (exceptionList.isEmpty()) { jobPluginInfo.incrementObjectsProcessedWithSuccess();