String selection = dialog.getSelection(); if(selection == null) return; int index = list.getSelectedIndex(); if(index == -1) index = listModel.getSize(); else index++;
Button selection = dialog.getSelection(); if(selection == null) return; int index = list.getSelectedIndex(); if(index == -1) index = listModel.getSize(); else index++;
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/options/ContextOptionPane.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/options/ToolBarOptionPane.java
Method name: void actionPerformed(ActionEvent) Method name: void actionPerformed(ActionEvent)
Number of AST nodes: 7 Number of AST nodes: 7
1
String selection = dialog.getSelection();
1
Button selection = dialog.getSelection();
2
				if(selection == null)
2
				if(selection == null)
3
					return;
3
					return;
4
				int index = list.getSelectedIndex();
4
				int index = list.getSelectedIndex();
5
				if(index == -1)
5
				if(index == -1)
6
					index = listModel.getSize();
6
					index = listModel.getSize();
7
				else
7
				else
8
					index++;
8
					index++;
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.8
Clones locationClones are in different classes
Number of node comparisons25
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                        
    4
    Button selection = dialog.getSelection();
    4
    String selection = dialog.getSelection();
                                                                                        
    5
    if (selection == null)
    5
    if (selection == null)
    5
    if (selection == null)
    Differences
    Expression1Expression2Difference
    java.lang.Stringorg.gjt.sp.jedit.options.ToolBarOptionPane.ButtonVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable selection does not match with type org.gjt.sp.jedit.options.ToolBarOptionPane.Button of variable selection
    • Make classes java.lang.String and org.gjt.sp.jedit.options.ToolBarOptionPane.Button extend a common superclass
    5
    if (selection == null)
    6
    return;
    6
    return;
    6
    return;
    Preondition Violations
    Conditional return;
    Conditional return;
    6
    return;
    7
    int index = list.getSelectedIndex();
    7
    int index = list.getSelectedIndex();
    8
    if (index == -1)
    8
    if (index == -1)
    9
    index = listModel.getSize();
    9
    index = listModel.getSize();
    else
    else
    10
    index++;
    10
    index++;
    Precondition Violations (3)
    Row Violation
    1Type java.lang.String of variable selection does not match with type org.gjt.sp.jedit.options.ToolBarOptionPane.Button of variable selection
    2Conditional return;
    3Conditional return;