if (f.exists()) { // file exists, user needs to confirm overwrite int confirm = JOptionPane.showConfirmDialog(FrameManager.getInstance() .getActiveFrame(), MailResourceLoader.getString("dialog", "saveas", "overwrite_existing_file"), MailResourceLoader.getString("dialog", "saveas", "file_exists"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (confirm == JOptionPane.NO_OPTION) { j--; continue; } }
if (!folder.isLeaf()) { // warn user JOptionPane.showMessageDialog(FrameManager.getInstance() .getActiveFrame(), "Your can only remove leaf folders!"); return; } else { // warn user in any other cases int n = JOptionPane.showConfirmDialog(null, MailResourceLoader .getString("tree", "tree", "folder_warning"), MailResourceLoader.getString("tree", "tree", "folder_warning_title"), JOptionPane.YES_NO_OPTION); if (n == JOptionPane.NO_OPTION) { return; } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/folder/command/SaveMessageSourceAsCommand.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/tree/action/RemoveFolderAction.java
Method name: void execute(IWorkerStatusController) Method name: void actionPerformed(ActionEvent)
Number of AST nodes: 5 Number of AST nodes: 6
1
if (f.exists()) {
1
if (
2
                    // file exists, user needs to confirm overwrite
3
                    int confirm = 
2
!folder.isLeaf()) {
3
			// warn user
4
JOptionPane.showConfirmDialog(FrameManager.getInstance()
4
			JOptionPane.showMessageDialog(FrameManager.getInstance()
5
        					.getActiveFrame(),
5
					.getActiveFrame(),
6
                           
6
					"Your can only remove leaf folders!");
7
			return;
8
		} else {
9
			// warn user in any other cases
7
 MailResourceLoader
10
			int n = JOptionPane.showConfirmDialog(null, MailResourceLoader
8
.getString("dialog", "saveas",
11
					.getString("
9
                                "overwrite_existing_file"),
10
                            
12
tree", "tree", "folder_warning"),
11
MailResourceLoader.getString("dialog", "saveas",
13
					MailResourceLoader.getString("
12
                                "file_exists"), JOptionPane.YES_NO_OPTION,
13
                            JOptionPane.QUESTION_MESSAGE);
14
                    if (confirm == JOptionPane.NO_OPTION) {
15
                        j--;
16
                        continue;
17
                    }
18
                
14
tree", "tree",
15
							"folder_warning_title"), JOptionPane.YES_NO_OPTION);
16
			if (n == JOptionPane.NO_OPTION) {
17
				return;
18
			}
19
}
19
		}
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 comparisons7
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)18.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    19
    int confirm = JOptionPane.showConfirmDialog(FrameManager.getInstance().getActiveFrame(), MailResourceLoader.getString("dialog", "saveas", "overwrite_existing_file"), MailResourceLoader.getString("dialog", "saveas", "file_exists"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
    19
    int confirm = JOptionPane.showConfirmDialog(FrameManager.getInstance().getActiveFrame(), MailResourceLoader.getString("dialog", "saveas", "overwrite_existing_file"), MailResourceLoader.getString("dialog", "saveas", "file_exists"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
    6
    int n = JOptionPane.showConfirmDialog(null, MailResourceLoader.getString("tree", "tree", "folder_warning"), MailResourceLoader.getString("tree", "tree", "folder_warning_title"), JOptionPane.YES_NO_OPTION);
    Differences
    Expression1Expression2Difference
    confirmnVARIABLE_NAME_MISMATCH
    JOptionPane.showConfirmDialog(FrameManager.getInstance().getActiveFrame(),MailResourceLoader.getString("dialog","saveas","overwrite_existing_file"),MailResourceLoader.getString("dialog","saveas","file_exists"),JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE)JOptionPane.showConfirmDialog(null,MailResourceLoader.getString("tree","tree","folder_warning"),MailResourceLoader.getString("tree","tree","folder_warning_title"),JOptionPane.YES_NO_OPTION)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression JOptionPane.showConfirmDialog(FrameManager.getInstance().getActiveFrame(),MailResourceLoader.getString("dialog","saveas","overwrite_existing_file"),MailResourceLoader.getString("dialog","saveas","file_exists"),JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression JOptionPane.showConfirmDialog(null,MailResourceLoader.getString("tree","tree","folder_warning"),MailResourceLoader.getString("tree","tree","folder_warning_title"),JOptionPane.YES_NO_OPTION) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    int n = JOptionPane.showConfirmDialog(null, MailResourceLoader.getString("tree", "tree", "folder_warning"), MailResourceLoader.getString("tree", "tree", "folder_warning_title"), JOptionPane.YES_NO_OPTION);
    20
    if (confirm == JOptionPane.NO_OPTION)
    20
    if (confirm == JOptionPane.NO_OPTION)
    7
    if (n == JOptionPane.NO_OPTION)
    Differences
    Expression1Expression2Difference
    confirmnVARIABLE_NAME_MISMATCH
    7
    if (n == JOptionPane.NO_OPTION)
                        
    8
    return;
    Preondition Violations
    Unmatched return;
    8
    return;
    21
    j--;
                    
    22
    continue;
    22
    continue;
    Preondition Violations
    Unmatched continue;
                              
    Precondition Violations (5)
    Row Violation
    1Expression JOptionPane.showConfirmDialog(FrameManager.getInstance().getActiveFrame(),MailResourceLoader.getString("dialog","saveas","overwrite_existing_file"),MailResourceLoader.getString("dialog","saveas","file_exists"),JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression JOptionPane.showConfirmDialog(null,MailResourceLoader.getString("tree","tree","folder_warning"),MailResourceLoader.getString("tree","tree","folder_warning_title"),JOptionPane.YES_NO_OPTION) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched return;
    4Unmatched continue;
    5The refactoring of the clones is infeasible, because classes org.columba.mail.folder.command.SaveMessageSourceAsCommand and org.columba.mail.gui.tree.action.RemoveFolderAction do not have a common superclass