try { DataSources.destroy( ds ); } catch ( SQLException sqle ) { log.warn( "could not destroy C3P0 connection pool", sqle ); }
if ( orphan.getTransaction() != null && orphan.getTransaction().isActive() ) { try { orphan.getTransaction().rollback(); } catch( Throwable t ) { log.debug( "Unable to rollback transaction for orphaned session", t ); } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/connection-c3p0/src/main/java/org/hibernate/connection/C3P0ConnectionProvider.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/context/ThreadLocalSessionContext.java
Method name: void close() Method name: void cleanupAnyOrphanedSession(SessionFactory)
Number of AST nodes: 2 Number of AST nodes: 3
1
try {
2
			DataSources.destroy( ds );
1
if ( orphan.getTransaction() != null && orphan.getTransaction().isActive() ) {
2
					try {
3
						orphan.getTransaction().rollback();
3
		}
4
					}
4
		catch ( SQLException sqle ) {
5
					catch( Throwable t ) {
5
			log.warn( "could not destroy C3P0 connection pool", sqle );
6
						log.
7
debug( "Unable to rollback transaction for orphaned session", t );
8
					}
6
		}
9
				}
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.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    try
    1
    try
    6
    try
    Differences
    Expression1Expression2Difference
    java.sql.SQLExceptionjava.lang.ThrowableSUBCLASS_TYPE_MISMATCH
    sqletVARIABLE_NAME_MISMATCH
    java.sql.SQLExceptionjava.lang.ThrowableSUBCLASS_TYPE_MISMATCH
    warndebugMETHOD_INVOCATION_NAME_MISMATCH
    "could not destroy C3P0 connection pool""Unable to rollback transaction for orphaned session"LITERAL_VALUE_MISMATCH
    sqletVARIABLE_NAME_MISMATCH
    java.sql.SQLExceptionjava.lang.ThrowableSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression log.warn("could not destroy C3P0 connection pool",sqle) is a void method call, and thus it cannot be parameterized
    Expression log.debug("Unable to rollback transaction for orphaned session",t) is a void method call, and thus it cannot be parameterized
    6
    try
    2
    DataSources.destroy(ds);
    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
                                                          
                                                                                
    7
    orphan.getTransaction().rollback();
    Precondition Violations (3)
    Row Violation
    1Expression log.warn("could not destroy C3P0 connection pool",sqle) is a void method call, and thus it cannot be parameterized
    2Expression log.debug("Unable to rollback transaction for orphaned session",t) 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