346-2-4

CategoryAxis a1 = new CategoryAxis("Test Axis"); a1.setTickLabelPaint("C1", new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.white)); CategoryAxis a2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(a1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); a2 = (CategoryAxis) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(a1, a2);
RingPlot p1 = new RingPlot(null); GradientPaint gp = new GradientPaint(1.0f, 2.0f, Color.yellow, 3.0f, 4.0f, Color.red); p1.setSeparatorPaint(gp); RingPlot p2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(p1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); p2 = (RingPlot) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(p1, p2);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/CategoryAxisTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/RingPlotTests.java
Method name: `void testSerialization()` |  | Method name: `void testSerialization()`
Number of AST nodes: 12 |  | Number of AST nodes: 13

1

    CategoryAxis a1 = new CategoryAxis("Test Axis");↵

2

            a1.setTickLabelPaint("C1",↵

1

    RingPlot p1 = new RingPlot(null);↵

3

     new GradientPaint(1.0f, 2.0f, Color.red, ↵

2

            GradientPaint gp = new GradientPaint(1.0f, 2.0f, Color.yellow,↵

4

                    3.0f, 4.0f, Color.white));↵

3

                    3.0f, 4.0f, Color.red);↵

5

            CategoryAxis a↵

4

            p1.setSeparatorPaint(gp);↵

6

    2 = null;↵

5

            RingPlot p2 = null;↵

7

            try {↵

6

            try {↵

8

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

7

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

9

                ObjectOutput out = new ObjectOutputStream(buffer);↵

8

                ObjectOutput out = new ObjectOutputStream(buffer);↵

10

                out.writeObject(a1);↵

9

                out.writeObject(p1);↵

11

                out.close();↵

10

                out.close();↵

12

                ObjectInput in = new ObjectInputStream(↵

11

                ObjectInput in = new ObjectInputStream(↵

13

                    new ByteArrayInputStream(buffer.toByteArray())↵

12

                        new ByteArrayInputStream(buffer.toByteArray())↵

14

                );↵

13

    );↵

15

                a2 = (CategoryAxis) in.readObject();↵

14

                p2 = (RingPlot) in.readObject();↵

16

                in.close();↵

15

                in.close();↵

17

            }↵

16

            }↵

18

            catch (Exception e) {↵

17

            catch (Exception e) {↵

19

                System.out.println(e.toString());↵

18

                e.printStackTrace();↵

20

            }↵

19

            }↵

21

            assertEquals(a1, a2);

20

            assertEquals(p1, p2);

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 0
Number of refactorable cases | 0
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 | 1