use of org.apache.jena.query.QueryFatalException in project jena by apache.
the class QueryIteratorBase method nextBinding.
/** final - subclasses implement moveToNextBinding() */
@Override
public final Binding nextBinding() {
try {
// Need to make sure to only read this once per iteration
boolean shouldCancel = requestingCancel;
if (shouldCancel && abortIterator) {
// Try to close first to release resources (in case the user
// doesn't have a close() call in a finally block)
close();
throw new QueryCancelledException();
}
if (finished)
throw new NoSuchElementException(Lib.className(this));
if (!hasNextBinding())
throw new NoSuchElementException(Lib.className(this));
Binding obj = moveToNextBinding();
if (obj == null)
throw new NoSuchElementException(Lib.className(this));
if (shouldCancel && !finished) {
// But .cancel sets both requestingCancel and abortIterator
// This only happens with a continuing iterator.
close();
}
return obj;
} catch (QueryFatalException ex) {
Log.error(this, "QueryFatalException", ex);
throw ex;
}
}
Aggregations