114-2-7

ChartRenderingInfo i1 = new ChartRenderingInfo(); i1.getPlotInfo().setDataArea(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0)); ChartRenderingInfo i2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(i1); out.close(); ObjectInput in = new ObjectInputStream(new ByteArrayInputStream( buffer.toByteArray())); i2 = (ChartRenderingInfo) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(i1, i2); assertEquals(i2, i2.getPlotInfo().getOwner());
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/junit/ChartRenderingInfoTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/block/junit/ColumnArrangementTests.java
Method name: `void testSerialization2()` |  | Method name: `void testSerialization()`
Number of AST nodes: 13 |  | Number of AST nodes: 11

1

    ChartRenderingInfo i1 = new ChartRenderingInfo();↵

2

            i1.getPlotInfo().setDataArea(new Rectangle2D.Double(1.0↵

1

    FlowArrangement f1 = new FlowArrangement(↵

3

    , 2.0, 3.0, ↵

2

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

4

          ↵

5

              4.0));↵

3

            );↵

6

            ChartRenderingInfo i2 = null;↵

4

            FlowArrangement f2 = null;↵

7

            try {↵

5

            try {↵

8

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

6

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

9

                ObjectOutput out = new ObjectOutputStream(buffer);↵

7

                ObjectOutput out = new ObjectOutputStream(buffer);↵

10

                out.writeObject(i1);↵

8

                out.writeObject(f1);↵

11

                out.close();↵

9

                out.close();↵

12

                ObjectInput in = new ObjectInputStream(↵

10

                ObjectInput in = new ObjectInputStream(↵

13

    new ByteArrayInputStream(↵

11

                    new ByteArrayInputStream(↵

14

                        buffer.toByteArray())↵

12

    buffer.toByteArray())↵

15

    );↵

13

                );↵

16

                i2 = (ChartRenderingInfo) in.readObject();↵

14

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

17

                in.close();↵

15

                in.close();↵

18

            }↵

16

            }↵

19

            catch (Exception e) {↵

17

            catch (Exception e) {↵

20

                e.printStackTrace();↵

18

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

21

            }↵

19

            }↵

22

            assertEquals(i1, i2);↵

20

            assertEquals(f1, ↵

23

            assertEquals(i2, i2.getPlotInfo().getOwner());

21

    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