for (CheckUpdateListener listener: _checkUpdateListeners) { try { listener.checkUpToDate(); } catch (Exception ex) { listener.showErrorMessage( "Unexpected Exception", "Update check failed with Exception: " + ex.getMessage(), ex); } }
if (printJob.printDialog()) { try { printJob.print(); } catch (PrinterException pe) { s_log.error("Error printing", pe); } }
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/update/gui/UpdateManagerDialog.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/util/PrintUtilities.java
Method name: void actionPerformed(ActionEvent) Method name: void print()
Number of AST nodes: 3 Number of AST nodes: 3
1
for (CheckUpdateListener listener: _checkUpdateListeners) {
1
if (printJob.printDialog()) {
2
               try {
2
            try {
3
                  listener.checkUpToDate();
3
                printJob.print();
4
               } catch (Exception ex) {
4
            } catch (PrinterException pe) {
5
                  listener.showErrorMessage(
5
                
6
                     "Unexpected Exception",
7
                     "Update check failed with Exception: " + ex.getMessage(),
8
                     ex);
6
s_log.error("Error printing", pe);
9
               }
7
            
10
    
8
}
11
        }
9
        }
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 comparisons5
  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)284.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    try
    3
    try
    4
    try
    Differences
    Expression1Expression2Difference
    java.lang.Exceptionjava.awt.print.PrinterExceptionSUBCLASS_TYPE_MISMATCH
    expeVARIABLE_NAME_MISMATCH
    java.lang.Exceptionjava.awt.print.PrinterExceptionSUBCLASS_TYPE_MISMATCH
    showErrorMessageerrorMETHOD_INVOCATION_NAME_MISMATCH
    listeners_logVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListenernet.sourceforge.squirrel_sql.fw.util.log.ILoggerVARIABLE_TYPE_MISMATCH
    listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex)s_log.error("Error printing",pe)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    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 s_log.error("Error printing",pe) 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) is a void method call, and thus it cannot be parameterized
    Expression s_log.error("Error printing",pe) is a void method call, and thus it cannot be parameterized
    Type net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener of variable listener does not match with type net.sourceforge.squirrel_sql.fw.util.log.ILogger of variable s_log
    • Make classes net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener and net.sourceforge.squirrel_sql.fw.util.log.ILogger extend a common superclass
    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 s_log.error("Error printing",pe) 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) is a void method call, and thus it cannot be parameterized
    Expression s_log.error("Error printing",pe) is a void method call, and thus it cannot be parameterized
    4
    try
    4
    listener.checkUpToDate();
    4
    listener.checkUpToDate();
    5
    printJob.print();
    Differences
    Expression1Expression2Difference
    checkUpToDateprintMETHOD_INVOCATION_NAME_MISMATCH
    listenerprintJobVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListenerjava.awt.print.PrinterJobVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression listener.checkUpToDate() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression printJob.print() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression listener.checkUpToDate() is a void method call, and thus it cannot be parameterized
    Expression printJob.print() is a void method call, and thus it cannot be parameterized
    Type net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener of variable listener does not match with type java.awt.print.PrinterJob of variable printJob
    • Make classes net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener and java.awt.print.PrinterJob extend a common superclass
    5
    printJob.print();
    Precondition Violations (15)
    Row Violation
    1Expression 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
    2Expression s_log.error("Error printing",pe) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex) is a void method call, and thus it cannot be parameterized
    4Expression s_log.error("Error printing",pe) is a void method call, and thus it cannot be parameterized
    5Type net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener of variable listener does not match with type net.sourceforge.squirrel_sql.fw.util.log.ILogger of variable s_log
    6Expression 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
    7Expression s_log.error("Error printing",pe) 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) is a void method call, and thus it cannot be parameterized
    9Expression s_log.error("Error printing",pe) is a void method call, and thus it cannot be parameterized
    10Expression listener.checkUpToDate() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression printJob.print() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    12Expression listener.checkUpToDate() is a void method call, and thus it cannot be parameterized
    13Expression printJob.print() is a void method call, and thus it cannot be parameterized
    14Type net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener of variable listener does not match with type java.awt.print.PrinterJob of variable printJob
    15The refactoring of the clones is infeasible, because classes and net.sourceforge.squirrel_sql.client.util.PrintUtilities do not have a common superclass