Transaction tx = getCurrentTransaction(); if ( tx == null ) { throw new IllegalStateException( "no current transaction to commit" ); } tx.commit();
Transaction tx = getCurrentTransaction(); if ( tx == null ) { throw new IllegalStateException( "no current transaction" ); } tx.rollback();
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/util/DualNodeJtaTransactionManagerImpl.java File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/util/DualNodeJtaTransactionManagerImpl.java
Method name: void commit() Method name: void rollback()
Number of AST nodes: 4 Number of AST nodes: 4
1
Transaction tx = getCurrentTransaction();
1
Transaction tx = getCurrentTransaction();
2
	    if ( tx == null ) {
2
        if ( tx == null ) {
3
			throw new IllegalStateException( "no current transaction to commit" );
3
			throw new IllegalStateException( "no current transaction" );
4
		}
4
		}
5
	    tx.commit();
5
        tx.rollback();
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are declared in the same class
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Transaction tx = getCurrentTransaction();
    1
    Transaction tx = getCurrentTransaction();
    2
    if (tx == null)
    2
    if (tx == null)
    3
    throw new IllegalStateException("no current transaction to commit");
    3
    throw new IllegalStateException("no current transaction to commit");
    3
    throw new IllegalStateException("no current transaction");
    Differences
    Expression1Expression2Difference
    "no current transaction to commit""no current transaction"LITERAL_VALUE_MISMATCH
    3
    throw new IllegalStateException("no current transaction");
    4
    tx.commit();
    4
    tx.commit();
    4
    tx.rollback();
    Differences
    Expression1Expression2Difference
    commitrollbackMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression tx.commit() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression tx.rollback() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression tx.commit() is a void method call, and thus it cannot be parameterized
    Expression tx.rollback() is a void method call, and thus it cannot be parameterized
    4
    tx.rollback();
    Precondition Violations (4)
    Row Violation
    1Expression tx.commit() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression tx.rollback() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression tx.commit() is a void method call, and thus it cannot be parameterized
    4Expression tx.rollback() is a void method call, and thus it cannot be parameterized