114-6-8

XYBoxAnnotation a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0, new BasicStroke(1.2f), Color.red, Color.blue); XYBoxAnnotation 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 = (XYBoxAnnotation) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(a1, a2);
FlowArrangement f1 = new FlowArrangement( HorizontalAlignment.LEFT, VerticalAlignment.TOP, 1.0, 2.0 ); FlowArrangement f2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(f1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); f2 = (FlowArrangement) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(f1, f2);

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

1

    XYBoxAnnotation a1 = new XYBoxAnnotation(1.0, 2.0, 3.0, 4.0,↵

2

                    new BasicStroke(1.2f), Color.red, Color.blue);↵

3

            XYBoxAnnotation a↵

1

    FlowArrangement f1 = new FlowArrangement(↵

2

                HorizontalAlignment.LEFT, VerticalAlignment.TOP, 1.0, 2.0↵

3

            );↵

4

    2 = null;↵

4

            FlowArrangement f2 = null;↵

5

            try {↵

5

            try {↵

6

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

6

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

7

                ObjectOutput out = new ObjectOutputStream(buffer);↵

7

                ObjectOutput out = new ObjectOutputStream(buffer);↵

8

                out.writeObject(a1);↵

8

                out.writeObject(f1);↵

9

                out.close();↵

9

                out.close();↵

10

                ObjectInput in = new ObjectInputStream(↵

10

                ObjectInput in = new ObjectInputStream(↵

11

    new ByteArrayInputStream(↵

11

                    new ByteArrayInputStream(↵

12

                        buffer.toByteArray())↵

12

    buffer.toByteArray())↵

13

    );↵

13

                );↵

14

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

14

                f2 = (FlowArrangement) in.readObject();↵

15

                in.close();↵

15

                in.close();↵

16

            }↵

16

            }↵

17

            catch (Exception e) {↵

17

            catch (Exception e) {↵

18

                e.printStackTrace();↵

18

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

19

            }↵

19

            }↵

20

            assertEquals(a1, a2);

20

            assertEquals(f1, f2);

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