Statement stmt = null;
try {
stmt = con.createStatement();
System.out.println("Executing sql: "+sql);
stmt.execute(sql);
} catch (SQLException e ) {
if (printError) {
e.printStackTrace();
}
} finally {
if (stmt != null) try { stmt.close(); } catch (SQLException e) {}
}
Statement stmt = null;
try
{
stmt = con.createStatement();
System.out.println("Executing sql: " + sql);
stmt.execute(sql);
} catch (SQLException e)
{
if (printError)
{
e.printStackTrace();
}
} finally
{
if (stmt != null)
try
{
stmt.close();
} catch (SQLException e)
{
}
}
Clone fragments detected by clone detection tool
File path: /sql12/test/adhoc/test/H2IdentifierQuoteTest.java
|
|
File path: /sql12/test/adhoc/test/IngresMoneyTest.java
|
Method name: void execute(Connection, String, boolean)
|
|
Method name: void execute(Connection, String, boolean)
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | Statement stmt = null;↵ | | 1 | Statement stmt = null;↵
|
2 | try {↵ | | |
|
3 | ↵ | | 2 | try↵
|
| | | 3 | {↵
|
4 | stmt = con.createStatement();↵ | | 4 | stmt = con.createStatement();↵
|
5 | System.out.println("Executing sql: "+sql);↵ | | 5 | System.out.println("Executing sql: " + sql);↵
|
6 | stmt.execute(sql);↵ | | 6 | stmt.execute(sql);↵
|
7 | } catch (SQLException e ) {↵ | | 7 | } catch (SQLException e↵
|
8 | if (printError) {↵ | | |
|
9 | e.printStackTrace();↵ | | |
|
10 | }↵ | | |
|
11 | } finally {↵ | | |
|
12 | if (stmt != null) try { ↵ | | 8 | )↵
|
| | | 9 | {↵
|
| | | 10 | if (printError)↵
|
| | | 11 | {↵
|
| | | 12 | e.printStackTrace();↵
|
| | | 13 | }↵
|
| | | 14 | } finally↵
|
| | | 15 | {↵
|
| | | 16 | if (stmt != null)↵
|
| | | 17 | try↵
|
| | | 18 | {↵
|
13 | stmt.close(); ↵ | | 19 | stmt.close();↵
|
14 | } catch (SQLException e) {}↵ | | 20 | } catch (SQLException e)↵
|
15 | ↵ | | |
|
| | | 21 | {↵
|
| | | 22 | }↵
|
16 | } | | 23 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4 |
Clones location | Clones are in different classes |
Number of node comparisons | 17 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 2.8 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | Statement stmt = null; | | 1 | Statement stmt = null; |
2 | try | | 2 | try |
3 | stmt = con.createStatement(); | | 3 | stmt = con.createStatement(); |
4 | System.out.println("Executing sql: " + sql); | | 4 | System.out.println("Executing sql: " + sql); |
5 | | | 5 | |
Precondition Violations (0)
Row |
Violation |