391-1-8

DateTick t1 = new DateTick( new Date(0L), "Label", TextAnchor.CENTER, TextAnchor.CENTER, 10.0 ); DateTick t2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(t1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); t2 = (DateTick) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(t1, t2);
BarRenderer3D r1 = new BarRenderer3D(); r1.setWallPaint(new GradientPaint(1.0f, 2.0f, Color.red, 4.0f, 3.0f, Color.blue)); BarRenderer3D r2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(r1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); r2 = (BarRenderer3D) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(r1, r2);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/DateTickTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/category/junit/BarRenderer3DTests.java
Method name: `void testSerialization()` |  | Method name: `void testSerialization()`
Number of AST nodes: 11 |  | Number of AST nodes: 12

1

    DateTick t1 = new DateTick(↵

2

                new Date(0L), "Label", TextAnchor.CENTER, TextAnchor.CENTER, 10.0↵

3

            );↵

4

            DateTick t↵

1

    BarRenderer3D r1 = new BarRenderer3D();↵

2

            r1.setWallPaint(new GradientPaint(1.0f, 2.0f, Color.red, 4.0f, 3.0f,↵

3

                    Color.blue));↵

5

    2 = null;↵

4

            BarRenderer3D r2 = null;↵

6

            try {↵

5

            try {↵

7

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

6

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

8

                ObjectOutput out = new ObjectOutputStream(buffer);↵

7

                ObjectOutput out = new ObjectOutputStream(buffer);↵

9

                out.writeObject(t1);↵

8

                out.writeObject(r1);↵

10

                out.close();↵

9

                out.close();↵

11

                ObjectInput in = new ObjectInputStream(↵

10

                ObjectInput in = new ObjectInputStream(↵

12

                    new ByteArrayInputStream(buffer.toByteArray())↵

11

                        new ByteArrayInputStream(buffer.toByteArray())↵

13

                );↵

12

    );↵

14

                t2 = (DateTick) in.readObject();↵

13

                r2 = (BarRenderer3D) in.readObject();↵

15

                in.close();↵

14

                in.close();↵

16

            }↵

15

            }↵

17

            catch (Exception e) {↵

16

            catch (Exception e) {↵

18

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

17

                e.printStackTrace();↵

19

            }↵

18

            }↵

20

            assertEquals(t1, t2);

19

            assertEquals(r1, r2);

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.1
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 1