DualNodeJtaTransactionImpl currentTransaction = DualNodeJtaTransactionManagerImpl.getInstance(nodeId).getCurrentTransaction(); if ( currentTransaction == null ) { isTransactional = false; return actualConnectionProvider.getConnection(); } else { isTransactional = true; Connection connection = currentTransaction.getEnlistedConnection(); if ( connection == null ) { connection = actualConnectionProvider.getConnection(); currentTransaction.enlistConnection( connection ); } return connection; }
SimpleJtaTransactionImpl currentTransaction = SimpleJtaTransactionManagerImpl.getInstance().getCurrentTransaction(); if ( currentTransaction == null ) { isTransactional = false; return actualConnectionProvider.getConnection(); } else { isTransactional = true; Connection connection = currentTransaction.getEnlistedConnection(); if ( connection == null ) { connection = actualConnectionProvider.getConnection(); currentTransaction.enlistConnection( connection ); } return connection; }
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/DualNodeConnectionProviderImpl.java File path: /hibernate-distribution-3.3.2.GA/project/testing/src/main/java/org/hibernate/test/tm/ConnectionProviderImpl.java
Method name: Connection getConnection() Method name: Connection getConnection()
Number of AST nodes: 10 Number of AST nodes: 10
1
DualNodeJtaTransactionImpl currentTransaction = DualNodeJtaTransactionManagerImpl.getInstance(nodeId).getCurrentTransaction();
1
SimpleJtaTransactionImpl currentTransaction = SimpleJtaTransactionManagerImpl.getInstance().getCurrentTransaction();
2
		if ( currentTransaction == null ) {
2
		if ( currentTransaction == null ) {
3
			isTransactional = false;
3
			isTransactional = false;
4
			return actualConnectionProvider.getConnection();
4
			return actualConnectionProvider.getConnection();
5
		}
5
		}
6
		else {
6
		else {
7
			isTransactional = true;
7
			isTransactional = true;
8
			Connection connection = currentTransaction.getEnlistedConnection();
8
			Connection connection = currentTransaction.getEnlistedConnection();
9
			if ( connection == null ) {
9
			if ( connection == null ) {
10
				connection = actualConnectionProvider.getConnection();
10
				connection = actualConnectionProvider.getConnection();
11
				currentTransaction.enlistConnection( connection );
11
				currentTransaction.enlistConnection( connection );
12
			}
12
			}
13
			return connection;
13
			return connection;
14
		}
14
		}
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.3
Clones locationClones are in different classes
Number of node comparisons46
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)13.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    DualNodeJtaTransactionImpl currentTransaction = DualNodeJtaTransactionManagerImpl.getInstance(nodeId).getCurrentTransaction();
    1
    DualNodeJtaTransactionImpl currentTransaction = DualNodeJtaTransactionManagerImpl.getInstance(nodeId).getCurrentTransaction();
    1
    SimpleJtaTransactionImpl currentTransaction = SimpleJtaTransactionManagerImpl.getInstance().getCurrentTransaction();
    Differences
    Expression1Expression2Difference
    org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionImplorg.hibernate.test.tm.SimpleJtaTransactionImplSUBCLASS_TYPE_MISMATCH
    org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionImplorg.hibernate.test.tm.SimpleJtaTransactionImplSUBCLASS_TYPE_MISMATCH
    org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionManagerImplorg.hibernate.test.tm.SimpleJtaTransactionManagerImplSUBCLASS_TYPE_MISMATCH
    DualNodeJtaTransactionManagerImpl.getInstance(nodeId)SimpleJtaTransactionManagerImpl.getInstance()ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression DualNodeJtaTransactionManagerImpl cannot be unified with expression SimpleJtaTransactionManagerImpl , because common superclass javax.transaction.TransactionManager does not declare member(s) public org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionImpl getCurrentTransaction() , public org.hibernate.test.tm.SimpleJtaTransactionImpl getCurrentTransaction()
    1
    SimpleJtaTransactionImpl currentTransaction = SimpleJtaTransactionManagerImpl.getInstance().getCurrentTransaction();
    2
    if (currentTransaction == null)
    2
    if (currentTransaction == null)
    2
    if (currentTransaction == null)
    Differences
    Expression1Expression2Difference
    org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionImplorg.hibernate.test.tm.SimpleJtaTransactionImplSUBCLASS_TYPE_MISMATCH
    2
    if (currentTransaction == null)
    3
    isTransactional = false;
    3
    isTransactional = false;
    4
    return actualConnectionProvider.getConnection();
    4
    return actualConnectionProvider.getConnection();
    else
    else
    5
    isTransactional = true;
    5
    isTransactional = true;
    6
    Connection connection = currentTransaction.getEnlistedConnection();
    6
    Connection connection = currentTransaction.getEnlistedConnection();
    6
    Connection connection = currentTransaction.getEnlistedConnection();
    Differences
    Expression1Expression2Difference
    org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionImplorg.hibernate.test.tm.SimpleJtaTransactionImplSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression currentTransaction cannot be unified with expression currentTransaction , because common superclass javax.transaction.Transaction does not declare member(s) public java.sql.Connection getEnlistedConnection()
    6
    Connection connection = currentTransaction.getEnlistedConnection();
    7
    if (connection == null)
    7
    if (connection == null)
    8
    connection = actualConnectionProvider.getConnection();
    8
    connection = actualConnectionProvider.getConnection();
    9
    currentTransaction.enlistConnection(connection);
    9
    currentTransaction.enlistConnection(connection);
    9
    currentTransaction.enlistConnection(connection);
    Differences
    Expression1Expression2Difference
    org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionImplorg.hibernate.test.tm.SimpleJtaTransactionImplSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression currentTransaction cannot be unified with expression currentTransaction , because common superclass javax.transaction.Transaction does not declare member(s) public void enlistConnection(java.sql.Connection)
    9
    currentTransaction.enlistConnection(connection);
    10
    return connection;
    10
    return connection;
    Precondition Violations (4)
    Row Violation
    1Expression DualNodeJtaTransactionManagerImpl cannot be unified with expression SimpleJtaTransactionManagerImpl , because common superclass javax.transaction.TransactionManager does not declare member(s) public org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionImpl getCurrentTransaction() , public org.hibernate.test.tm.SimpleJtaTransactionImpl getCurrentTransaction()
    2Expression currentTransaction cannot be unified with expression currentTransaction , because common superclass javax.transaction.Transaction does not declare member(s) public java.sql.Connection getEnlistedConnection()
    3Expression currentTransaction cannot be unified with expression currentTransaction , because common superclass javax.transaction.Transaction does not declare member(s) public void enlistConnection(java.sql.Connection)
    4Not all possible execution flows end in a return statement