408-2-13

CategoryPointerAnnotation a1 = new CategoryPointerAnnotation("Label", "A", 20.0, Math.PI); CategoryPointerAnnotation 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 = (CategoryPointerAnnotation) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(a1, a2);
Day d1 = new Day(15, 4, 2000); Day d2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(d1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); d2 = (Day) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(d1, d2);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/annotations/junit/CategoryPointerAnnotationTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/DayTests.java
Method name: `void testSerialization()` |  | Method name: `void testSerialization()`
Number of AST nodes: 11 |  | Number of AST nodes: 11

1

    CategoryPointerAnnotation a1 = new CategoryPointerAnnotation("Label",↵

2

                    "A", 20.0, Math.PI);↵

3

            CategoryPointerAnnotation a↵

1

    Day d1 = new Day(15, 4, 2000);↵

4

    2 = null;↵

2

            Day d2 = null;↵

5

            try {↵

3

            try {↵

6

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

4

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

7

                ObjectOutput out = new ObjectOutputStream(buffer);↵

5

                ObjectOutput out = new ObjectOutputStream(buffer);↵

8

                out.writeObject(a1);↵

6

                out.writeObject(d1);↵

9

                out.close();↵

7

                out.close();↵

10

                ObjectInput in = new ObjectInputStream(↵

8

                ObjectInput in = new ObjectInputStream(↵

11

    new ByteArrayInputStream(↵

9

                    new ByteArrayInputStream(↵

12

                        buffer.toByteArray())↵

10

    buffer.toByteArray())↵

13

    );↵

11

                );↵

14

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

12

                d2 = (Day) in.readObject();↵

15

                in.close();↵

13

                in.close();↵

16

            }↵

14

            }↵

17

            catch (Exception e) {↵

15

            catch (Exception e) {↵

18

                e.printStackTrace();↵

16

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

19

            }↵

17

            }↵

20

            assertEquals(a1, a2);

18

            assertEquals(d1, d2);

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