if (action.equals("FORMATTED_NAME_DIALOG")) { fullNameDialog.setVisible(true); boolean success = fullNameDialog.getResult(); if (success) { String fn = fullNameDialog.getFormattedName(); // fill formatted textfield formattedNameTextField.setText(fn); fillSortStringComboBox(); } }
boolean success = ColumbaDesktop.getInstance().open(tempFile); // if attachment can't be opened, save it only if (!success) { File saveToFile = getDestinationFile(header); if (saveToFile.exists()) saveToFile.delete(); tempFile.renameTo(saveToFile); }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/contact/src/main/java/org/columba/addressbook/gui/dialog/contact/ContactEditorDialog.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/message/command/OpenAttachmentCommand.java
Method name: void actionPerformed(ActionEvent) Method name: void updateGUI()
Number of AST nodes: 7 Number of AST nodes: 6
1
if (action.equals("FORMATTED_NAME_DIALOG")) {
2
			fullNameDialog.setVisible(true);
3
			boolean success = fullNameDialog.getResult();
1
boolean success = ColumbaDesktop.getInstance().open(tempFile);
2
				// if attachment can't be opened, save it only
4
			if (success) {
3
				if (!success) {
5
				String fn = fullNameDialog.getFormattedName();
4
					File saveToFile = getDestinationFile(header);
6
				// fill formatted textfield
5
				
7
				formattedNameTextField.setText(fn
6
	if (saveToFile.exists())
8
);
7
						saveToFile.delete();
9
				fillSortStringComboBox();
8
					tempFile.renameTo(saveToFile);
10
			}
9
			
11
		}
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.2
Clones locationClones are in different classes
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)2.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                    
    21
    boolean success = ColumbaDesktop.getInstance().open(tempFile);
    9
    if (action.equals("FORMATTED_NAME_DIALOG"))
    9
    if (action.equals("FORMATTED_NAME_DIALOG"))
    22
    if (!success)
    Differences
    Expression1Expression2Difference
    action.equals("FORMATTED_NAME_DIALOG")!successTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression !success cannot be parameterized, because it has dependencies to/from statements that will be extracted
    22
    if (!success)
    10
    fullNameDialog.setVisible(true);
                                                                            
    11
    boolean success = fullNameDialog.getResult();
                                                                                                  
                                                                                                  
    23
    File saveToFile = getDestinationFile(header);
    Preondition Violations
    Unmatched statement File saveToFile=getDestinationFile(header); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    23
    File saveToFile = getDestinationFile(header);
    12
    if (success)
    12
    if (success)
    24
    if (saveToFile.exists())
    Differences
    Expression1Expression2Difference
    successsaveToFile.exists()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression success cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression saveToFile.exists() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    24
    if (saveToFile.exists())
    13
    String fn = fullNameDialog.getFormattedName();
                                                                                                    
    14
    formattedNameTextField.setText(fn);
                                                                                  
    15
    fillSortStringComboBox();
    15
    fillSortStringComboBox();
    Preondition Violations
    Unmatched statement fillSortStringComboBox(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                              
                                                    
    25
    saveToFile.delete();
    Preondition Violations
    Unmatched statement saveToFile.delete(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    25
    saveToFile.delete();
                                                                        
    26
    tempFile.renameTo(saveToFile);
    Preondition Violations
    Unmatched statement tempFile.renameTo(saveToFile); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    26
    tempFile.renameTo(saveToFile);
    Precondition Violations (8)
    Row Violation
    1Expression !success cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Unmatched statement File saveToFile=getDestinationFile(header); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Expression success cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression saveToFile.exists() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Unmatched statement fillSortStringComboBox(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched statement saveToFile.delete(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement tempFile.renameTo(saveToFile); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8The refactoring of the clones is infeasible, because classes org.columba.addressbook.gui.dialog.contact.ContactEditorDialog and org.columba.mail.gui.message.command.OpenAttachmentCommand do not have a common superclass