try { con.rollback(); } catch (Exception e) { e.printStackTrace(); }
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/test/mockobjects/net/sourceforge/squirrel_sql/client/session/MockSession.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/update/gui/UpdateManagerDialog.java
Method name: void rollback() Method name: void actionPerformed(ActionEvent)
Number of AST nodes: 2 Number of AST nodes: 3
1
try {
2
            con.rollback();
1
for (CheckUpdateListener listener: _checkUpdateListeners) {
2
               try {
3
                  listener.checkUpToDate();
3
        } catch (Exception e) {
4
               } catch (Exception ex) {
4
            e.printStackTrace();
5
             
6
     listener.showErrorMessage(
7
                     "Unexpected Exception",
8
                     "Update check failed with Exception: " + ex.getMessage(),
9
                     ex);
10
               }
5
        }
11
            }
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)335.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    try
    1
    try
    3
    try
    Differences
    Expression1Expression2Difference
    eexVARIABLE_NAME_MISMATCH
    printStackTraceshowErrorMessageMETHOD_INVOCATION_NAME_MISMATCH
    elistenerVARIABLE_NAME_MISMATCH
    java.lang.Exceptionnet.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListenerVARIABLE_TYPE_MISMATCH
    e.printStackTrace()listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression e.printStackTrace() 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 e.printStackTrace() 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
    Expression e cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.Exception of variable e does not match with type net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener of variable listener
    • Make classes java.lang.Exception and net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener extend a common superclass
    Expression e.printStackTrace() 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 e.printStackTrace() 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
    con.rollback();
    2
    con.rollback();
    4
    listener.checkUpToDate();
    Differences
    Expression1Expression2Difference
    rollbackcheckUpToDateMETHOD_INVOCATION_NAME_MISMATCH
    conlistenerVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.sql.SQLConnectionnet.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListenerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression con.rollback() 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 con.rollback() 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.SQLConnection of variable con does not match with type net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener of variable listener
    • Make classes net.sourceforge.squirrel_sql.fw.sql.SQLConnection and net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener extend a common superclass
    4
    listener.checkUpToDate();
    Precondition Violations (16)
    Row Violation
    1Expression e.printStackTrace() 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 e.printStackTrace() 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
    5Expression e cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type java.lang.Exception of variable e does not match with type net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener of variable listener
    7Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression 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
    9Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized
    10Expression listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex) is a void method call, and thus it cannot be parameterized
    11Expression con.rollback() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    12Expression listener.checkUpToDate() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression con.rollback() is a void method call, and thus it cannot be parameterized
    14Expression listener.checkUpToDate() is a void method call, and thus it cannot be parameterized
    15Type net.sourceforge.squirrel_sql.fw.sql.SQLConnection of variable con does not match with type net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener of variable listener
    16The refactoring of the clones is infeasible, because classes net.sourceforge.squirrel_sql.client.session.MockSession and do not have a common superclass