if (child instanceof AddressbookFolder) { try { ((AddressbookFolder) child).save(); } catch (Exception ex) { ex.printStackTrace(); } }
try { Desktop.browse(url); } catch (DesktopException e) { JOptionPane.showMessageDialog(FrameManager.getInstance() .getActiveFrame(), GlobalResourceLoader.getString( "org.columba.core.i18n.dialog", "error", "no_browser"), "Error", JOptionPane.ERROR_MESSAGE); }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/shutdown/SaveAllAddressbooksPlugin.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/desktop/JDICDesktop.java
Method name: void saveFolders(AddressbookTreeNode) Method name: void browse(URL)
Number of AST nodes: 3 Number of AST nodes: 2
1
if (child instanceof AddressbookFolder) {
2
                try {
3
                    ((AddressbookFolder) child).save();
4
                
1
try {
2
			Desktop.browse(url);
5
} catch (Exception ex) {
3
		} catch (DesktopException e) {
6
                    ex.printStackT
4
			JOptionPane.showMessageDialog(FrameManager.getInstance()
7
race();
5
					.getActiveFrame()
8
                }
9
            
6
, GlobalResourceLoader.getString(
7
					"org.columba.core.i18n.dialog", "error", "no_browser"),
8
					"Error", JOptionPane.ERROR_MESSAGE);
10
}
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 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)20.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    try
    4
    try
    1
    try
    Differences
    Expression1Expression2Difference
    java.lang.Exceptionorg.jdesktop.jdic.desktop.DesktopExceptionSUBCLASS_TYPE_MISMATCH
    exeVARIABLE_NAME_MISMATCH
    java.lang.Exceptionorg.jdesktop.jdic.desktop.DesktopExceptionSUBCLASS_TYPE_MISMATCH
    printStackTraceshowMessageDialogMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Exceptionjavax.swing.JOptionPaneVARIABLE_TYPE_MISMATCH
    ex.printStackTrace()JOptionPane.showMessageDialog(FrameManager.getInstance().getActiveFrame(),GlobalResourceLoader.getString("org.columba.core.i18n.dialog","error","no_browser"),"Error",JOptionPane.ERROR_MESSAGE)TYPE_COMPATIBLE_REPLACEMENT
    ex.printStackTrace()JOptionPane.showMessageDialog(FrameManager.getInstance().getActiveFrame(),GlobalResourceLoader.getString("org.columba.core.i18n.dialog","error","no_browser"),"Error",JOptionPane.ERROR_MESSAGE)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression ex.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ex.printStackTrace() is a void method call, and thus it cannot be parameterized
    Expression JOptionPane.showMessageDialog(FrameManager.getInstance().getActiveFrame(),GlobalResourceLoader.getString("org.columba.core.i18n.dialog","error","no_browser"),"Error",JOptionPane.ERROR_MESSAGE) is a void method call, and thus it cannot be parameterized
    Expression ex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.Exception of variable ex does not match with type javax.swing.JOptionPane of variable JOptionPane
    • Make classes java.lang.Exception and javax.swing.JOptionPane extend a common superclass
    Expression ex.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ex.printStackTrace() is a void method call, and thus it cannot be parameterized
    Expression JOptionPane.showMessageDialog(FrameManager.getInstance().getActiveFrame(),GlobalResourceLoader.getString("org.columba.core.i18n.dialog","error","no_browser"),"Error",JOptionPane.ERROR_MESSAGE) is a void method call, and thus it cannot be parameterized
    1
    try
                                                  
    2
    Desktop.browse(url);
    Preondition Violations
    Unmatched statement Desktop.browse(url); 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
    2
    Desktop.browse(url);
    5
    ((AddressbookFolder)child).save();
    5
    ((AddressbookFolder)child).save();
    Preondition Violations
    Unmatched statement ((AddressbookFolder)child).save(); 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
                                                                              
    Precondition Violations (11)
    Row Violation
    1Expression ex.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression ex.printStackTrace() is a void method call, and thus it cannot be parameterized
    3Expression JOptionPane.showMessageDialog(FrameManager.getInstance().getActiveFrame(),GlobalResourceLoader.getString("org.columba.core.i18n.dialog","error","no_browser"),"Error",JOptionPane.ERROR_MESSAGE) is a void method call, and thus it cannot be parameterized
    4Expression ex cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Type java.lang.Exception of variable ex does not match with type javax.swing.JOptionPane of variable JOptionPane
    6Expression ex.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression ex.printStackTrace() is a void method call, and thus it cannot be parameterized
    8Expression JOptionPane.showMessageDialog(FrameManager.getInstance().getActiveFrame(),GlobalResourceLoader.getString("org.columba.core.i18n.dialog","error","no_browser"),"Error",JOptionPane.ERROR_MESSAGE) is a void method call, and thus it cannot be parameterized
    9Unmatched statement Desktop.browse(url); 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 ((AddressbookFolder)child).save(); 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 org.columba.addressbook.shutdown.SaveAllAddressbooksPlugin and org.columba.core.desktop.JDICDesktop do not have a common superclass