188-3-4

boolean success = false; try { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(1.0, "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new LayeredBarRenderer()); 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 { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(1.0, "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new MinMaxCategoryRenderer()); 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/LayeredBarRendererTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/category/junit/MinMaxCategoryRendererTests.java
Method name: `void testDrawWithNullInfo()` |  | Method name: `void testDrawWithNullInfo()`
Number of AST nodes: 9 |  | Number of AST nodes: 9

1

    boolean success = false;↵

1

    boolean success = false;↵

2

            try {↵

2

            try {↵

3

                DefaultCategoryDataset dataset = new DefaultCategoryDataset();↵

3

                DefaultCategoryDataset dataset = new DefaultCategoryDataset();↵

4

                dataset.addValue(1.0, "S1", "C1");↵

4

                dataset.addValue(1.0, "S1", "C1");↵

5

                CategoryPlot plot = new CategoryPlot(dataset,↵

5

                CategoryPlot plot = new CategoryPlot(dataset,↵

6

                        new CategoryAxis("Category"), new NumberAxis("Value"),↵

6

                        new CategoryAxis("Category"), new NumberAxis("Value"),↵

7

                        new LayeredBarRenderer());↵

7

                        new MinMaxCategoryRenderer());↵

8

                JFreeChart chart = new JFreeChart(plot);↵

8

                JFreeChart chart = new JFreeChart(plot);↵

9

                /* BufferedImage image = */ chart.createBufferedImage(300, 200,↵

9

                /* BufferedImage image = */ chart.createBufferedImage(300, 200,↵

10

                        null);↵

10

                        null);↵

11

                success = true;↵

11

                success = true;↵

12

            }↵

12

            }↵

13

            catch (NullPointerException e) {↵

13

            catch (NullPointerException e) {↵

14

                e.printStackTrace();↵

14

                e.printStackTrace();↵

15

                success = false;↵

15

                success = false;↵

16

            }↵

16

            }↵

17

            assertTrue(success);

17

            assertTrue(success);

See real code fragment |  | See real code fragment

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

1. {Refactorable}

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

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

   1

       boolean success = false;

   1

       boolean success = false;

   2

       try

   2

       try

   3

       DefaultCategoryDataset dataset = new DefaultCategoryDataset();

   3

       DefaultCategoryDataset dataset = new DefaultCategoryDataset();

   4

       dataset.addValue(1.0, "S1", "C1");

   4

       dataset.addValue(1.0, "S1", "C1");

   5

       CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new LayeredBarRenderer());

   5

       CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new MinMaxCategoryRenderer());

   6

       JFreeChart chart = new JFreeChart(plot);

   6

       JFreeChart chart = new JFreeChart(plot);

   7

       chart.createBufferedImage(300, 200, null);

   7

       chart.createBufferedImage(300, 200, null);

   8

       success = true;

   8

       success = true;

   9

       assertTrue(success);

   9

       assertTrue(success);

   Precondition Violations (0)
   Row | Violation
   --- | ---