if ( ps != null ) { try { ps.close(); } catch( Throwable t ) {} }
if ( rs != null ) { try { rs.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(PreparedStatement) Method name: void release(ResultSet)
Number of AST nodes: 3 Number of AST nodes: 3
1
if ( ps != null ) {
1
if ( rs != null ) {
2
			try {
2
			try {
3
				ps.close();
3
				rs.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.3
Clones locationClones are declared in the same class
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    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.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (ps != null)
    1
    if (ps != null)
    1
    if (rs != null)
    Differences
    Expression1Expression2Difference
    psrsVARIABLE_NAME_MISMATCH
    java.sql.PreparedStatementjava.sql.ResultSetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.sql.PreparedStatement of variable ps does not match with type java.sql.ResultSet of variable rs
    • Make classes java.sql.PreparedStatement and java.sql.ResultSet extend a common superclass
    1
    if (rs != null)
    2
    try
    2
    try
    3
    ps.close();
    3
    ps.close();
    3
    rs.close();
    Differences
    Expression1Expression2Difference
    psrsVARIABLE_NAME_MISMATCH
    java.sql.PreparedStatementjava.sql.ResultSetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.sql.PreparedStatement of variable ps does not match with type java.sql.ResultSet of variable rs
    • Make classes java.sql.PreparedStatement and java.sql.ResultSet extend a common superclass
    3
    rs.close();
    Precondition Violations (2)
    Row Violation
    1Type java.sql.PreparedStatement of variable ps does not match with type java.sql.ResultSet of variable rs
    2Type java.sql.PreparedStatement of variable ps does not match with type java.sql.ResultSet of variable rs