isTransactional = true; Connection connection = currentTransaction.getEnlistedConnection(); if ( connection == null ) { connection = actualConnectionProvider.getConnection(); currentTransaction.enlistConnection( connection ); } return connection;
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/testing/src/main/java/org/hibernate/test/tm/ConnectionProviderImpl.java File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/util/DualNodeConnectionProviderImpl.java
Method name: Connection getConnection() Method name: Connection getConnection()
Number of AST nodes: 6 Number of AST nodes: 6
1
isTransactional = true;
1
isTransactional = true;
2
			Connection connection = currentTransaction.getEnlistedConnection();
2
			Connection connection = currentTransaction.getEnlistedConnection();
3
			if ( connection == null ) {
3
			if ( connection == null ) {
4
				connection = actualConnectionProvider.getConnection();
4
				connection = actualConnectionProvider.getConnection();
5
				currentTransaction.enlistConnection( connection );
5
				currentTransaction.enlistConnection( connection );
6
			}
6
			}
7
			return connection;
7
			return connection;
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.2
Clones locationClones are in different classes
Number of node comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    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.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    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.tm.SimpleJtaTransactionImplorg.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionImplVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.tm.SimpleJtaTransactionImpl of variable currentTransaction does not match with type org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionImpl of variable currentTransaction
    • Make classes org.hibernate.test.tm.SimpleJtaTransactionImpl and org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionImpl extend a common superclass
    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.tm.SimpleJtaTransactionImplorg.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionImplVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.tm.SimpleJtaTransactionImpl of variable currentTransaction does not match with type org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionImpl of variable currentTransaction
    • Make classes org.hibernate.test.tm.SimpleJtaTransactionImpl and org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionImpl extend a common superclass
    9
    currentTransaction.enlistConnection(connection);
    10
    return connection;
    10
    return connection;
    Precondition Violations (2)
    Row Violation
    1Type org.hibernate.test.tm.SimpleJtaTransactionImpl of variable currentTransaction does not match with type org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionImpl of variable currentTransaction
    2Type org.hibernate.test.tm.SimpleJtaTransactionImpl of variable currentTransaction does not match with type org.hibernate.test.cache.jbc2.functional.util.DualNodeJtaTransactionImpl of variable currentTransaction