boolean success = false; try { DefaultStatisticalCategoryDataset dataset = new DefaultStatisticalCategoryDataset(); dataset.add(1.0, 2.0, "S1", "C1"); dataset.add(null, new Double(4.0), "S1", "C2"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new StatisticalBarRenderer()); plot.setOrientation(PlotOrientation.HORIZONTAL); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, null); success = true; } catch (NullPointerException e) { e.printStackTrace(); success = false; } assertTrue(success);
boolean success = false; try { DefaultStatisticalCategoryDataset dataset = new DefaultStatisticalCategoryDataset(); dataset.add(1.0, 2.0, "S1", "C1"); dataset.add(new Double(4.0), null, "S1", "C2"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new StatisticalBarRenderer()); plot.setOrientation(PlotOrientation.HORIZONTAL); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, null); success = true; } catch (NullPointerException e) { e.printStackTrace(); success = false; } assertTrue(success);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/category/junit/StatisticalBarRendererTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/category/junit/StatisticalBarRendererTests.java
Method name: void testDrawWithNullMeanHorizontal() Method name: void testDrawWithNullDeviationHorizontal()
Number of AST nodes: 11 Number of AST nodes: 11
1
boolean success = false;
1
boolean success = false;
2
        try {
2
        try {
3
            DefaultStatisticalCategoryDataset dataset
3
            DefaultStatisticalCategoryDataset dataset
4
                    = new DefaultStatisticalCategoryDataset();
4
                    = new DefaultStatisticalCategoryDataset();
5
            dataset.add(1.0, 2.0, "S1", "C1");
5
            dataset.add(1.0, 2.0, "S1", "C1");
6
            dataset.add(null, new Double(4.0), "S1", "C2");
6
            dataset.add(new Double(4.0), null, "S1", "C2");
7
            CategoryPlot plot = new CategoryPlot(dataset,
7
            CategoryPlot plot = new CategoryPlot(dataset,
8
                    new CategoryAxis("Category"), new NumberAxis("Value"),
8
                    new CategoryAxis("Category"), new NumberAxis("Value"),
9
                    new StatisticalBarRenderer());
9
                    new StatisticalBarRenderer());
10
            plot.setOrientation(PlotOrientation.HORIZONTAL);
10
            plot.setOrientation(PlotOrientation.HORIZONTAL);
11
            JFreeChart chart = new JFreeChart(plot);
11
            JFreeChart chart = new JFreeChart(plot);
12
            /* BufferedImage image = */ chart.createBufferedImage(300, 200,
12
            /* BufferedImage image = */ chart.createBufferedImage(300, 200,
13
                    null);
13
                    null);
14
            success = true;
14
            success = true;
15
        }
15
        }
16
        catch (NullPointerException e) {
16
        catch (NullPointerException e) {
17
            e.printStackTrace();
17
            e.printStackTrace();
18
            success = false;
18
            success = false;
19
        }
19
        }
20
        assertTrue(success);
20
        assertTrue(success);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are declared in the same class
Number of node comparisons85
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)113.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    boolean success = false;
    1
    boolean success = false;
    2
    try
    2
    try
    3
    DefaultStatisticalCategoryDataset dataset = new DefaultStatisticalCategoryDataset();
    3
    DefaultStatisticalCategoryDataset dataset = new DefaultStatisticalCategoryDataset();
    4
    dataset.add(1.0, 2.0, "S1", "C1");
    4
    dataset.add(1.0, 2.0, "S1", "C1");
    5
    dataset.add(null, new Double(4.0), "S1", "C2");
    5
    dataset.add(null, new Double(4.0), "S1", "C2");
    5
    dataset.add(new Double(4.0), null, "S1", "C2");
    Differences
    Expression1Expression2Difference
    nullnew Double(4.0)TYPE_COMPATIBLE_REPLACEMENT
    new Double(4.0)nullTYPE_COMPATIBLE_REPLACEMENT
    5
    dataset.add(new Double(4.0), null, "S1", "C2");
    6
    CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new StatisticalBarRenderer());
    6
    CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new StatisticalBarRenderer());
    7
    plot.setOrientation(PlotOrientation.HORIZONTAL);
    7
    plot.setOrientation(PlotOrientation.HORIZONTAL);
    8
    JFreeChart chart = new JFreeChart(plot);
    8
    JFreeChart chart = new JFreeChart(plot);
    9
    chart.createBufferedImage(300, 200, null);
    9
    chart.createBufferedImage(300, 200, null);
    10
    success = true;
    10
    success = true;
    11
    assertTrue(success);
    11
    assertTrue(success);
    Precondition Violations (0)
    Row Violation