142-32-35

PieLabelRecord p1 = new PieLabelRecord("A", 1.0, 2.0, new TextBox("B"), 3.0, 4.0, 5.0); PieLabelRecord 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 = (PieLabelRecord) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } boolean b = p1.equals(p2); assertTrue(b);
Task t1 = new Task("T", new Date(1), new Date(2)); Task 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 = (Task) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(t1, t2);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/PieLabelRecordTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/gantt/junit/TaskTests.java
Method name: `void testSerialization()` |  | Method name: `void testSerialization()`
Number of AST nodes: 12 |  | Number of AST nodes: 11

1

    PieLabelRecord p1 = new PieLabelRecord("A", 1.0, 2.0, new TextBox("B"), ↵

1

    Task t1 = new Task("T", ↵

2

                    3.0, 4.0, 5.0);↵

3

            PieLabelRecord p↵

2

    new Date(1), new Date(2));↵

4

    2 = null;↵

3

            Task t2 = null;↵

5

            try {↵

4

            try {↵

6

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

5

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

7

                ObjectOutput out = new ObjectOutputStream(buffer);↵

6

                ObjectOutput out = new ObjectOutputStream(buffer);↵

8

                out.writeObject(p1);↵

7

                out.writeObject(t1);↵

9

                out.close();↵

8

                out.close();↵

10

                ObjectInput in = new ObjectInputStream(↵

9

                ObjectInput in = new ObjectInputStream(↵

11

                        new ByteArrayInputStream(buffer.toByteArray())↵

10

                    new ByteArrayInputStream(buffer.toByteArray())↵

12

    );↵

11

                );↵

13

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

12

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

14

                in.close();↵

13

                in.close();↵

15

            }↵

14

            }↵

16

            catch (Exception e) {↵

15

            catch (Exception e) {↵

17

                e.printStackTrace();↵

16

                ↵

18

            }↵

19

            boolean b = p1.equals(p2);↵

20

            assertTrue(b↵

17

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

18

            }↵

21

    );

19

            assertEquals(t1, t2);

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