1014-1-2

ChartEditor editor = ChartEditorManager.getChartEditor(this.chart); int result = JOptionPane.showConfirmDialog(this, editor, localizationResources.getString("Chart_Properties"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); if (result == JOptionPane.OK_OPTION) { editor.updateChart(this.chart); }
StrokeChooserPanel panel = new StrokeChooserPanel( null, this.availableStrokeSamples ); int result = JOptionPane.showConfirmDialog( this, panel, localizationResources.getString("Stroke_Selection"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE ); if (result == JOptionPane.OK_OPTION) { this.gridStrokeSample.setStroke(panel.getSelectedStroke()); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/ChartPanel.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/editor/DefaultNumberAxisEditor.java
Method name: `void doEditChartProperties()` |  | Method name: `void attemptGridStrokeSelection()`
Number of AST nodes: 4 |  | Number of AST nodes: 4

1

    ChartEditor editor = ChartEditorManager.getChartEditor(this.chart↵

1

    StrokeChooserPanel panel = new StrokeChooserPanel(↵

2

                null, this.availableStrokeSamples↵

2

    );↵

3

            );↵

3

            int result = JOptionPane.showConfirmDialog(this, editor,↵

4

            int result = JOptionPane.showConfirmDialog(↵

4

                    localizationResources.getString("Chart_Properties"),↵

5

                this, panel, localizationResources.getString("Stroke_Selection"),↵

5

                    JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);↵

6

                JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE↵

7

            );↵

6

            if (result == JOptionPane.OK_OPTION) {↵

8

            if (result == JOptionPane.OK_OPTION) {↵

7

                editor.updateChart(this.chart);↵

9

                this.gridStrokeSample.setStroke(panel.getSelectedStroke());↵

8

            }

10

            }

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 8

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 2
   Number of unmapped statements in the first code fragment | 2
   Number of unmapped statements in the second code fragment | 2
   Time elapsed for statement mapping (ms) | 0.6
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       StrokeChooserPanel panel = new StrokeChooserPanel(null, this.availableStrokeSamples);

   1

       ChartEditor editor = ChartEditorManager.getChartEditor(this.chart);

   2

       int result = JOptionPane.showConfirmDialog(this, editor, localizationResources.getString("Chart_Properties"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);

   2 | int result = JOptionPane.showConfirmDialog(this, editor, localizationResources.getString("Chart_Properties"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
   2 | int result = JOptionPane.showConfirmDialog(this, panel, localizationResources.getString("Stroke_Selection"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   editor | panel | VARIABLE_NAME_MISMATCH
   org.jfree.chart.editor.ChartEditor | org.jfree.ui.StrokeChooserPanel | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.editor.ChartEditor of variable editor does not match with type org.jfree.ui.StrokeChooserPanel of variable panel
   - Make classes org.jfree.chart.editor.ChartEditor and org.jfree.ui.StrokeChooserPanel extend a common superclass

   2

       int result = JOptionPane.showConfirmDialog(this, panel, localizationResources.getString("Stroke_Selection"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);

   3

       if (result == JOptionPane.OK_OPTION)

   3

       if (result == JOptionPane.OK_OPTION)

   4

       this.gridStrokeSample.setStroke(panel.getSelectedStroke());

   4

       editor.updateChart(this.chart);

   Precondition Violations (1)
   Row | Violation
   --- | ---
   1 | Type org.jfree.chart.editor.ChartEditor of variable editor does not match with type org.jfree.ui.StrokeChooserPanel of variable panel