if ( rs != null ) { try { rs.close(); } catch( Throwable t ) {} }
if ( session != null ) { try { session.close(); } catch( Throwable t ) {} }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/hql/QueryTranslatorTestCase.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/hql/QueryTranslatorTestCase.java
Method name: void release(ResultSet) Method name: void release(Session)
Number of AST nodes: 3 Number of AST nodes: 3
1
if ( rs != null ) {
1
if ( session != null ) {
2
			try {
2
			try {
3
				rs.close();
3
				session.close();
4
			}
4
			}
5
			catch( Throwable t ) {}
5
			catch( Throwable t ) {}
6
		}
6
		}
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 declared in the same class
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    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.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (rs != null)
    1
    if (rs != null)
    1
    if (session != null)
    Differences
    Expression1Expression2Difference
    rssessionVARIABLE_NAME_MISMATCH
    java.sql.ResultSetorg.hibernate.classic.SessionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.sql.ResultSet of variable rs does not match with type org.hibernate.classic.Session of variable session
    • Make classes java.sql.ResultSet and org.hibernate.classic.Session extend a common superclass
    1
    if (session != null)
    2
    try
    2
    try
                                          
    3
    session.close();
    Preondition Violations
    Unmatched statement session.close(); 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
    3
    session.close();
    3
    rs.close();
    3
    rs.close();
    Preondition Violations
    Unmatched statement rs.close(); 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
                                
    Precondition Violations (3)
    Row Violation
    1Type java.sql.ResultSet of variable rs does not match with type org.hibernate.classic.Session of variable session
    2Unmatched statement session.close(); 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
    3Unmatched statement rs.close(); 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