Skip to content

Commit

Permalink
Merge pull request apache#715 from afs/jena1870-txn-abort-exceptions
Browse files Browse the repository at this point in the history
JENA-1870: Remove assembler-only TransactionAbortException
  • Loading branch information
afs authored Mar 26, 2020
2 parents f01d4ba + 8272f38 commit 81a777a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@

package org.apache.jena.assembler.assemblers;

import java.util.*;
import java.util.List;
import java.util.function.Function;

import org.apache.jena.assembler.* ;
import org.apache.jena.assembler.exceptions.* ;
import org.apache.jena.assembler.Assembler;
import org.apache.jena.assembler.Content;
import org.apache.jena.assembler.JA;
import org.apache.jena.assembler.Mode;
import org.apache.jena.rdf.model.* ;
import org.apache.jena.shared.* ;
import org.apache.jena.shared.PrefixMapping;
import org.apache.jena.vocabulary.RDF ;

public abstract class ModelAssembler extends AssemblerBase implements Assembler
Expand All @@ -41,19 +43,15 @@ protected Model openModel( Assembler a, Resource root, Content initial, Mode mod
/** Execute an action in a transaction if the model supports transactions.*/
private static void exec(Model m, Resource root, Runnable action) {
boolean b = m.supportsTransactions();
// No m.executeInTxn because of test MockModel.
if ( b ) m.begin();
try {
action.run();
if ( b ) m.commit();
}
catch (Throwable t) {
// Compatibility ...
if ( b ) {
m.abort();
throw new TransactionAbortedException(root, t);
}
else
throw t;
if ( b ) m.abort();
throw t;
}
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.*;

import org.apache.jena.assembler.* ;
import org.apache.jena.assembler.exceptions.TransactionAbortedException ;
import org.apache.jena.rdf.model.* ;

public class TestModelContent extends AssemblerTestBase
Expand Down Expand Up @@ -94,9 +93,8 @@ public void testContentTransactionsAbort()
a.open( Assembler.content, root );
fail( "should throw (wrapped) failing exception" );
}
catch (TransactionAbortedException e)
catch (Exception e)
{
assertEquals( resource( "x" ), e.getRoot() );
assertEquals( listOfStrings( "supports[true] begin add abort" ), history );
assertIsoModels( expected, toDeliver );
}
Expand Down

This file was deleted.

0 comments on commit 81a777a

Please sign in to comment.