try { connection.commit(); } catch (SQLException e) { log.error("Failed to commit connection - "+connection, e); }
if (_panel != null) { try { getCommand().execute(); } catch (Exception e) { _panel.getSession().showMessage(e); } }
Clone fragments detected by clone detection tool
File path: /sql12/plugins/dbcopy/src/net/sourceforge/squirrel_sql/plugins/dbcopy/CopyExecutor.java File path: /sql12/plugins/postgres/src/net/sourceforge/squirrel_sql/plugins/postgres/actions/AbstractSQLPanelAction.java
Method name: void commitConnection(ISQLConnection) Method name: void actionPerformed(ActionEvent)
Number of AST nodes: 2 Number of AST nodes: 3
1
try {
2
            connection.commit();
1
if (_panel != null) {
2
            try {
3
                getCommand().execute();
3
        } catch (SQLException e) {
4
            } catch (Exception e) {
4
            log.error("Failed to commit connection - "+connection, e);
5
                _panel.getSession().showMessage(e);
6
            }
5
        }
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)5.3
Clones locationClones are in different classes
Number of node comparisons4
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)66.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    try
    1
    try
    2
    try
    Differences
    Expression1Expression2Difference
    java.sql.SQLExceptionjava.lang.ExceptionSUBCLASS_TYPE_MISMATCH
    java.sql.SQLExceptionjava.lang.ExceptionSUBCLASS_TYPE_MISMATCH
    errorshowMessageMETHOD_INVOCATION_NAME_MISMATCH
    log_panel.getSession()AST_TYPE_MISMATCH
    log.error("Failed to commit connection - " + connection,e)_panel.getSession().showMessage(e)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression log.error("Failed to commit connection - " + connection,e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression _panel.getSession().showMessage(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression log.error("Failed to commit connection - " + connection,e) is a void method call, and thus it cannot be parameterized
    Expression _panel.getSession().showMessage(e) is a void method call, and thus it cannot be parameterized
    Expression log.error("Failed to commit connection - " + connection,e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression _panel.getSession().showMessage(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression log.error("Failed to commit connection - " + connection,e) is a void method call, and thus it cannot be parameterized
    Expression _panel.getSession().showMessage(e) is a void method call, and thus it cannot be parameterized
    2
    try
    2
    connection.commit();
    2
    connection.commit();
    Preondition Violations
    Unmatched statement connection.commit(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                  
                                                        
    3
    getCommand().execute();
    Preondition Violations
    Unmatched statement getCommand().execute(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    3
    getCommand().execute();
    Precondition Violations (11)
    Row Violation
    1Expression log.error("Failed to commit connection - " + connection,e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression _panel.getSession().showMessage(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression log.error("Failed to commit connection - " + connection,e) is a void method call, and thus it cannot be parameterized
    4Expression _panel.getSession().showMessage(e) is a void method call, and thus it cannot be parameterized
    5Expression log.error("Failed to commit connection - " + connection,e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression _panel.getSession().showMessage(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression log.error("Failed to commit connection - " + connection,e) is a void method call, and thus it cannot be parameterized
    8Expression _panel.getSession().showMessage(e) is a void method call, and thus it cannot be parameterized
    9Unmatched statement connection.commit(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    10Unmatched statement getCommand().execute(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    11The refactoring of the clones is infeasible, because classes net.sourceforge.squirrel_sql.plugins.dbcopy.CopyExecutor and net.sourceforge.squirrel_sql.plugins.postgres.actions.AbstractSQLPanelAction do not have a common superclass