try { connection.commit(); } catch (SQLException e) { log.error("Failed to commit connection - "+connection, e); }
for (CheckUpdateListener listener: _checkUpdateListeners) { try { listener.checkUpToDate(); } catch (Exception ex) { listener.showErrorMessage( "Unexpected Exception", "Update check failed with Exception: " + ex.getMessage(), ex); } }
Clone fragments detected by clone detection tool
File path: /sql12/plugins/dbcopy/src/net/sourceforge/squirrel_sql/plugins/dbcopy/CopyExecutor.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/update/gui/UpdateManagerDialog.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
for (CheckUpdateListener listener: _checkUpdateListeners) {
2
               try {
3
();
3
                  listener.checkUpToDate();
4
        } catch (SQLException e) {
4
               } catch (Exception ex) {
5
            log.error("Failed to commit connection - "+connection,
5
                  listener.showErrorMessage(
6
                     "Unexpected Exception",
7
                     "Update check failed with Exception: " + ex.getMessage(),
6
 e);
8
                     ex);
9
               }
7
        }
10
            }
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 in different classes
Number of node comparisons4
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)358.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    try
    1
    try
    3
    try
    Differences
    Expression1Expression2Difference
    java.sql.SQLExceptionjava.lang.ExceptionSUBCLASS_TYPE_MISMATCH
    eexVARIABLE_NAME_MISMATCH
    java.sql.SQLExceptionjava.lang.ExceptionSUBCLASS_TYPE_MISMATCH
    errorshowErrorMessageMETHOD_INVOCATION_NAME_MISMATCH
    loglistenerVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.util.log.ILoggernet.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListenerVARIABLE_TYPE_MISMATCH
    log.error("Failed to commit connection - " + connection,e)listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex)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 listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex) 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 listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex) is a void method call, and thus it cannot be parameterized
    Type net.sourceforge.squirrel_sql.fw.util.log.ILogger of variable log does not match with type net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener of variable listener
    • Make classes net.sourceforge.squirrel_sql.fw.util.log.ILogger and net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener extend a common superclass
    Expression log.error("Failed to commit connection - " + connection,e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex) 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 listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex) is a void method call, and thus it cannot be parameterized
    3
    try
    2
    connection.commit();
    2
    connection.commit();
    4
    listener.checkUpToDate();
    Differences
    Expression1Expression2Difference
    commitcheckUpToDateMETHOD_INVOCATION_NAME_MISMATCH
    connectionlistenerVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.sql.ISQLConnectionnet.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListenerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression connection.commit() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression listener.checkUpToDate() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression connection.commit() is a void method call, and thus it cannot be parameterized
    Expression listener.checkUpToDate() is a void method call, and thus it cannot be parameterized
    Type net.sourceforge.squirrel_sql.fw.sql.ISQLConnection of variable connection does not match with type net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener of variable listener
    • Make classes net.sourceforge.squirrel_sql.fw.sql.ISQLConnection and net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener extend a common superclass
    4
    listener.checkUpToDate();
    Precondition Violations (15)
    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 listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex) 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 listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex) is a void method call, and thus it cannot be parameterized
    5Type net.sourceforge.squirrel_sql.fw.util.log.ILogger of variable log does not match with type net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener of variable listener
    6Expression log.error("Failed to commit connection - " + connection,e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression log.error("Failed to commit connection - " + connection,e) is a void method call, and thus it cannot be parameterized
    9Expression listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex) is a void method call, and thus it cannot be parameterized
    10Expression connection.commit() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    11Expression listener.checkUpToDate() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression connection.commit() is a void method call, and thus it cannot be parameterized
    13Expression listener.checkUpToDate() is a void method call, and thus it cannot be parameterized
    14Type net.sourceforge.squirrel_sql.fw.sql.ISQLConnection of variable connection does not match with type net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener of variable listener
    15The refactoring of the clones is infeasible, because classes net.sourceforge.squirrel_sql.plugins.dbcopy.CopyExecutor and do not have a common superclass