synchronized (this) { if (excaliburSource != null) { excaliburSource.dispose(); } excaliburSource = null; }
if (rs != null) { rs.close(); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/jdbc/config/DataSourceElement.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java
Method name: void testEnded() Method name: void close(ResultSet)
Number of AST nodes: 4 Number of AST nodes: 2
1
synchronized (this) {
2
			if (excaliburSource != null) {
3
				excaliburSource.dispose();
4
			}
5
		    excaliburSource = null;
1
if (rs != null) {
2
			    rs.close();
6
		}
3
			}
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.1
Clones locationClones are in different classes having the same super class
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    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
    2
    if (excaliburSource != null)
    2
    if (excaliburSource != null)
    2
    if (rs != null)
    Differences
    Expression1Expression2Difference
    excaliburSourcersVARIABLE_NAME_MISMATCH
    org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcDataSourcejava.sql.ResultSetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcDataSource of variable excaliburSource does not match with type java.sql.ResultSet of variable rs
    • Make classes org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcDataSource and java.sql.ResultSet extend a common superclass
    2
    if (rs != null)
                                
    3
    rs.close();
    3
    excaliburSource.dispose();
                                                              
    Precondition Violations (1)
    Row Violation
    1Type org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcDataSource of variable excaliburSource does not match with type java.sql.ResultSet of variable rs