boolean auto = true;
try
{
auto = conn.getAutoCommit();
}
catch (SQLException ex)
{
s_log.error("Error with transaction control", ex);
_session.showErrorMessage(ex);
}
try
{
conn.setAutoCommit(props.getAutoCommit());
}
catch (SQLException ex)
{
props.setAutoCommit(auto);
_session.showErrorMessage(ex);
}
boolean auto = true;
try
{
auto = conn.getAutoCommit();
}
catch (SQLException ex)
{
s_log.error("Error with transaction control", ex);
_session.showErrorMessage(ex);
}
try
{
conn.setAutoCommit(props.getAutoCommit());
}
catch (SQLException ex)
{
props.setAutoCommit(auto);
_session.showErrorMessage(ex);
}
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/SQLPanel.java
|
|
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/SQLResultExecuterPanel.java
|
Method name: void run()
|
|
Method name: void run()
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | boolean auto = true;↵ | | 1 | boolean auto = true;↵
|
2 | try↵ | | 2 | try↵
|
3 | {↵ | | 3 | {↵
|
4 | auto = conn.getAutoCommit();↵ | | 4 | auto = conn.getAutoCommit();↵
|
5 | }↵ | | 5 | }↵
|
6 | catch (SQLException ex)↵ | | 6 | catch (SQLException ex)↵
|
7 | {↵ | | 7 | {↵
|
8 | s_log.error("Error with transaction control", ex);↵ | | 8 | s_log.error("Error with transaction control", ex);↵
|
9 | _session.showErrorMessage(ex);↵ | | 9 | _session.showErrorMessage(ex);↵
|
10 | }↵ | | 10 | }↵
|
11 | try↵ | | 11 | try↵
|
12 | {↵ | | 12 | {↵
|
13 | conn.setAutoCommit(props.getAutoCommit());↵ | | 13 | conn.setAutoCommit(props.getAutoCommit());↵
|
14 | }↵ | | 14 | }↵
|
15 | catch (SQLException ex)↵ | | 15 | catch (SQLException ex)↵
|
16 | {↵ | | 16 | {↵
|
17 | props.setAutoCommit(auto);↵ | | 17 | props.setAutoCommit(auto);↵
|
18 | _session.showErrorMessage(ex);↵ | | 18 | _session.showErrorMessage(ex);↵
|
19 | } | | 19 | }
|
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) | 1.1 |
Clones location | Clones are in different classes |
Number of node comparisons | 15 |
-
{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) | 5.8 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
4 | boolean auto = true; | | 4 | boolean auto = true; |
5 | try | | 5 | try |
6 | auto = conn.getAutoCommit(); | | 6 | auto = conn.getAutoCommit(); |
7 | try | | 7 | try |
8 | conn.setAutoCommit(props.getAutoCommit()); | | 8 | conn.setAutoCommit(props.getAutoCommit()); |
Precondition Violations (0)
Row |
Violation |