try { if (rs != null) { rs.close(); } } catch (SQLException e) { log.warn("Error closing ResultSet", e); }
try { if (c != null) { c.close(); } } catch (SQLException e) { log.warn("Error closing Connection", e); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java
Method name: void close(ResultSet) Method name: void close(Connection)
Number of AST nodes: 3 Number of AST nodes: 3
1
try {
1
try {
2
			if (rs != null) {
2
			if (c != null) {
3
			    rs.close();
3
			    c.close();
4
			}
4
			}
5
		} catch (SQLException e) {
5
		} catch (SQLException e) {
6
			log.warn("Error closing ResultSet", e);
6
			log.warn("Error closing Connection", e);
7
		}
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.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.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    try
    1
    try
    1
    try
    Differences
    Expression1Expression2Difference
    "Error closing ResultSet""Error closing Connection"LITERAL_VALUE_MISMATCH
    1
    try
    2
    if (rs != null)
    2
    if (rs != null)
    2
    if (c != null)
    Differences
    Expression1Expression2Difference
    rscVARIABLE_NAME_MISMATCH
    java.sql.ResultSetjava.sql.ConnectionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.sql.ResultSet of variable rs does not match with type java.sql.Connection of variable c
    • Make classes java.sql.ResultSet and java.sql.Connection extend a common superclass
    2
    if (c != null)
    3
    rs.close();
    3
    rs.close();
    3
    c.close();
    Differences
    Expression1Expression2Difference
    rscVARIABLE_NAME_MISMATCH
    java.sql.ResultSetjava.sql.ConnectionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.sql.ResultSet of variable rs does not match with type java.sql.Connection of variable c
    • Make classes java.sql.ResultSet and java.sql.Connection extend a common superclass
    3
    c.close();
    Precondition Violations (2)
    Row Violation
    1Type java.sql.ResultSet of variable rs does not match with type java.sql.Connection of variable c
    2Type java.sql.ResultSet of variable rs does not match with type java.sql.Connection of variable c