return new ExceptionConvertingIteration<Statement, SailException>(iter) {
@Override
protected SailException convert(Exception e) {
if (e instanceof IOException) {
return new SailException(e);
}
else if (e instanceof RuntimeException) {
throw (RuntimeException)e;
}
else if (e == null) {
throw new IllegalArgumentException("e must not be null");
}
else {
throw new IllegalArgumentException("Unexpected exception type: " + e.getClass());
}
}
};
}
catch (IOException e) {
readLock.release();
throw new SailException("Unable to get statements", e);
}
catch (RuntimeException e) {
readLock.release();
throw e;
}