This is an automated email from the ASF dual-hosted git repository. andy pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/jena.git
commit dbc0a6061f2e3c0312c5c16276b35085426fe908 Author: Andy Seaborne <[email protected]> AuthorDate: Fri Nov 8 10:31:19 2024 +0000 GH-2755: DatasetGraphText call operations in correct order --- .../apache/jena/query/text/DatasetGraphText.java | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/jena-text/src/main/java/org/apache/jena/query/text/DatasetGraphText.java b/jena-text/src/main/java/org/apache/jena/query/text/DatasetGraphText.java index 8a6276ff4e..e9b226c63b 100644 --- a/jena-text/src/main/java/org/apache/jena/query/text/DatasetGraphText.java +++ b/jena-text/src/main/java/org/apache/jena/query/text/DatasetGraphText.java @@ -255,14 +255,22 @@ public class DatasetGraphText extends DatasetGraphTextMonitor implements Transac super.end(); return; } - if ( readWriteMode.get() == ReadWrite.WRITE ) { - // If we are still in a write transaction at this point, then commit - // was never called, so rollback the TextIndex and the dataset. - abortAction.run(); + ReadWrite rwMode = readWriteMode.get(); + switch(rwMode) { + case READ ->{ + super.getMonitor().finish(); + super.end(); + readWriteMode.set(null); + } + case WRITE ->{ + // If we are still in a write transaction at this point, then commit + // was never called, so rollback the TextIndex and the dataset. + super.getMonitor().finish(); + abortAction.run(); + super.end(); + readWriteMode.set(null); + } } - super.end(); - super.getMonitor().finish(); - readWriteMode.set(null); } @Override
