Skip to content

Commit 246072e

Browse files
committed
code cleanup
1 parent 7c7cfd3 commit 246072e

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

core/queryalgebra/evaluation/src/main/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/DefaultEvaluationStrategy.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -716,9 +716,18 @@ protected QueryEvaluationStep prepare(DescribeOperator node, QueryEvaluationCont
716716

717717
@Override
718718
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(BindingSet bs) {
719-
return new DescribeIteration(child.evaluate(bs), DefaultEvaluationStrategy.this,
720-
node.getBindingNames(),
721-
bs);
719+
CloseableIteration<BindingSet, QueryEvaluationException> evaluate = null;
720+
721+
try {
722+
evaluate = child.evaluate(bs);
723+
return new DescribeIteration(evaluate, DefaultEvaluationStrategy.this, node.getBindingNames(), bs);
724+
} catch (Throwable t) {
725+
if (evaluate != null) {
726+
evaluate.close();
727+
}
728+
throw t;
729+
}
730+
722731
}
723732
};
724733
}

core/queryalgebra/evaluation/src/main/java/org/eclipse/rdf4j/query/algebra/evaluation/iterator/DescribeIteration.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,11 @@ protected void handleClose() throws QueryEvaluationException {
230230
if (currentDescribeExprIter != null)
231231
currentDescribeExprIter.close();
232232
} finally {
233-
234-
}
235-
if (sourceIter instanceof CloseableIteration) {
236-
((CloseableIteration<?, QueryEvaluationException>) sourceIter).close();
233+
if (sourceIter instanceof CloseableIteration) {
234+
((CloseableIteration<?, QueryEvaluationException>) sourceIter).close();
235+
}
237236
}
237+
238238
}
239239
}
240240
}

0 commit comments

Comments
 (0)