if (conn != null) { 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); } }
if (conn != null) { 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: 6 Number of AST nodes: 6
1
if (conn != null)
1
if (conn != null)
2
            {
2
            {
3
                boolean auto = true;
3
                boolean auto = true;
4
                try
4
                try
5
                {
5
                {
6
                    auto = conn.getAutoCommit();
6
                    auto = conn.getAutoCommit();
7
                }
7
                }
8
                catch (SQLException ex)
8
                catch (SQLException ex)
9
                {
9
                {
10
                    s_log.error("Error with transaction control", ex);
10
                    s_log.error("Error with transaction control", ex);
11
                    _session.showErrorMessage(ex);
11
                    _session.showErrorMessage(ex);
12
                }
12
                }
13
                try
13
                try
14
                {
14
                {
15
                    conn.setAutoCommit(props.getAutoCommit());
15
                    conn.setAutoCommit(props.getAutoCommit());
16
                }
16
                }
17
                catch (SQLException ex)
17
                catch (SQLException ex)
18
                {
18
                {
19
                    props.setAutoCommit(auto);
19
                    props.setAutoCommit(auto);
20
                    _session.showErrorMessage(ex);
20
                    _session.showErrorMessage(ex);
21
                }
21
                }
22
            }
22
            }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)1.1
Clones locationClones are in different classes
Number of node comparisons17
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)6.2
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    3
    if (conn != null)
    3
    if (conn != null)
    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