if ( rootSession == null ) { try { interceptor.beforeTransactionCompletion(tx); } catch (Throwable t) { log.error("exception in interceptor beforeTransactionCompletion()", t); } }
try { DataSources.destroy( ds ); } catch ( SQLException sqle ) { log.warn( "could not destroy C3P0 connection pool", sqle ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/impl/SessionImpl.java File path: /hibernate-distribution-3.3.2.GA/project/connection-c3p0/src/main/java/org/hibernate/connection/C3P0ConnectionProvider.java
Method name: void beforeTransactionCompletion(Transaction) Method name: void close()
Number of AST nodes: 3 Number of AST nodes: 2
1
if ( rootSession == null ) {
2
			try {
3
				interceptor.beforeTransactionCompletion(tx
1
try {
4
);
2
			DataSources.destroy( ds );
5
			}
3
		}
6
			catch (Throwable t) {
4
		catch ( SQLException sqle ) {
7
				log.error("exception in interceptor beforeTransactionCompletion()", t);
5
			log.
8
			}
6
warn( "could not destroy C3P0 connection pool", sqle );
9
		}
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)0.2
Clones locationClones are in different classes
Number of node comparisons4
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    try
    3
    try
    1
    try
    Differences
    Expression1Expression2Difference
    java.lang.Throwablejava.sql.SQLExceptionSUBCLASS_TYPE_MISMATCH
    tsqleVARIABLE_NAME_MISMATCH
    java.lang.Throwablejava.sql.SQLExceptionSUBCLASS_TYPE_MISMATCH
    errorwarnMETHOD_INVOCATION_NAME_MISMATCH
    "exception in interceptor beforeTransactionCompletion()""could not destroy C3P0 connection pool"LITERAL_VALUE_MISMATCH
    tsqleVARIABLE_NAME_MISMATCH
    java.lang.Throwablejava.sql.SQLExceptionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression log.error("exception in interceptor beforeTransactionCompletion()",t) is a void method call, and thus it cannot be parameterized
    Expression log.warn("could not destroy C3P0 connection pool",sqle) is a void method call, and thus it cannot be parameterized
    1
    try
                                                          
    2
    DataSources.destroy(ds);
    Preondition Violations
    Unmatched statement DataSources.destroy(ds); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    2
    DataSources.destroy(ds);
    4
    interceptor.beforeTransactionCompletion(tx);
                                                                                                  
    Precondition Violations (3)
    Row Violation
    1Expression log.error("exception in interceptor beforeTransactionCompletion()",t) is a void method call, and thus it cannot be parameterized
    2Expression log.warn("could not destroy C3P0 connection pool",sqle) is a void method call, and thus it cannot be parameterized
    3Unmatched statement DataSources.destroy(ds); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted