if ( !connection.isClosed() ) { JDBCExceptionReporter.logAndClearWarnings( connection ); } factory.getConnectionProvider().closeConnection( connection ); connection = null;
boolean isAutocommit = connectionManager.isAutoCommit(); connectionManager.afterTransaction(); if ( isAutocommit ) { owner.afterTransactionCompletion(success, null); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/jdbc/ConnectionManager.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/jdbc/JDBCContext.java
Method name: void closeConnection() Method name: void afterNontransactionalQuery(boolean)
Number of AST nodes: 4 Number of AST nodes: 4
1
if ( !connection.isClosed() ) {
2
				JDBCExceptionReporter.logAndClearWarnings( conne
1
boolean isAutocommit = connectionManager.isAutoCommit();
3
ction );
2
			connectionManager.afterTransaction();
4
			}
3
			
5
			factory.getConnectionProvider().closeConnection( connection );
4
			
6
			connection = null;
5
if ( isAutocommit ) {
6
				owner.afterTransactionCompletion(success, null);
7
			}
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)5.2
Clones locationClones are in different classes
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)14.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                      
    3
    boolean isAutocommit = connectionManager.isAutoCommit();
                                                                                    
    4
    connectionManager.afterTransaction();
    Preondition Violations
    Unmatched statement connectionManager.afterTransaction(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4
    connectionManager.afterTransaction();
    4
    if (!connection.isClosed())
    4
    if (!connection.isClosed())
    5
    if (isAutocommit)
    Differences
    Expression1Expression2Difference
    !connection.isClosed()isAutocommitTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression isAutocommit cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    if (isAutocommit)
    5
    JDBCExceptionReporter.logAndClearWarnings(connection);
    5
    JDBCExceptionReporter.logAndClearWarnings(connection);
    Preondition Violations
    Unmatched statement JDBCExceptionReporter.logAndClearWarnings(connection); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                      
                                                                                                        
    6
    owner.afterTransactionCompletion(success, null);
    6
    factory.getConnectionProvider().closeConnection(connection);
                                                                                                                                  
    7
    connection = null;
    7
    connection = null;
    Preondition Violations
    Unmatched statement connection=null; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                          
    Precondition Violations (5)
    Row Violation
    1Unmatched statement connectionManager.afterTransaction(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Expression isAutocommit cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement JDBCExceptionReporter.logAndClearWarnings(connection); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement connection=null; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero