if (action.equals("EDIT")) { String inputValue = JOptionPane.showInputDialog( GlobalResourceLoader.getString(RESOURCE_PATH, "profiles", "enter_name"), selection); if (inputValue == null) { return; } // rename profile in profiles.xml ProfileManager.getInstance().renameProfile(selection, inputValue); // modify listmodel model.setElementAt(inputValue, model.indexOf(selection)); selection = inputValue; }
String inputValue = JOptionPane.showInputDialog( GlobalResourceLoader.getString(RESOURCE_PATH, "profiles", "enter_name"), selection); if (inputValue == null) { return; } // rename profile in profiles.xml ProfileManager.getInstance().renameProfile(selection, inputValue); // modify listmodel model.setElementAt(inputValue, model.indexOf(selection)); selection = inputValue;
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/profiles/ProfileChooserDialog.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/profiles/ProfileManagerDialog.java
Method name: void actionPerformed(ActionEvent) Method name: void actionPerformed(ActionEvent)
Number of AST nodes: 7 Number of AST nodes: 6
1
if (action.equals("EDIT")) {
2
            String inputValue = JOptionPane.showInputDialog(
1
String inputValue = JOptionPane.showInputDialog(
3
                GlobalResourceLoader.getString(RESOURCE_PATH, "profiles",
2
					GlobalResourceLoader.getString(RESOURCE_PATH, "profiles",
4
                "enter_name"), selection);
3
							"enter_name"), selection);
5
            
6
            
7
if (inputValue == null) {
4
			if (inputValue == null) {
8
                return;
9
            }
10
            
11
            
5
				return;
6
			}
12
// rename profile in profiles.xml
7
			// rename profile in profiles.xml
13
            ProfileManager.getInstance().renameProfile(selection, inputValue);
8
			ProfileManager.getInstance().renameProfile(selection, inputValue);
14
            
15
            
16
// modify listmodel
9
			// modify listmodel
17
            model.setElementAt(inputValue, model.indexOf(selection));
10
			model.setElementAt(inputValue, model.indexOf(selection));
18
            
19
selection = inputValue;
11
			selection = inputValue;
20
        }
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 having the same super class
Number of node comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)10.0
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    18
    String inputValue = JOptionPane.showInputDialog(GlobalResourceLoader.getString(RESOURCE_PATH, "profiles", "enter_name"), selection);
    18
    String inputValue = JOptionPane.showInputDialog(GlobalResourceLoader.getString(RESOURCE_PATH, "profiles", "enter_name"), selection);
    19
    if (inputValue == null)
    19
    if (inputValue == null)
    20
    return;
    20
    return;
    20
    return;
    Preondition Violations
    Conditional return;
    Conditional return;
    20
    return;
    21
    ProfileManager.getInstance().renameProfile(selection, inputValue);
    21
    ProfileManager.getInstance().renameProfile(selection, inputValue);
    22
    model.setElementAt(inputValue, model.indexOf(selection));
    22
    model.setElementAt(inputValue, model.indexOf(selection));
    23
    selection = inputValue;
    23
    selection = inputValue;
    Precondition Violations (2)
    Row Violation
    1Conditional return;
    2Conditional return;