142-1-40

MultipleXYSeriesLabelGenerator g1 = new MultipleXYSeriesLabelGenerator(); g1.addSeriesLabel(0, "Add0"); g1.addSeriesLabel(0, "Add0b"); g1.addSeriesLabel(1, "Add1"); MultipleXYSeriesLabelGenerator g2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(g1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); g2 = (MultipleXYSeriesLabelGenerator) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(g1, g2);
TimePeriodAnchor a1 = TimePeriodAnchor.START; TimePeriodAnchor 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 = (TimePeriodAnchor) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertTrue(a1 == a2);

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

1

    MultipleXYSeriesLabelGenerator g1↵

2

                    = new MultipleXYSeriesLabelGenerator();↵

3

            g1.addSeriesLabel(0, "Add0");↵

4

            g1.addSeriesLabel(0, "Add0b");↵

5

            g1.addSeriesLabel(1, "Add1");↵

6

            MultipleXYSeriesLabelGenerat↵

1

    TimePeriodAnchor a1 = TimePeriodAnchor.START;↵

7

    or g2 = null;↵

2

            TimePeriodAnchor a2 = null;↵

8

            try {↵

3

            try {↵

9

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

4

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

10

                ObjectOutput out = new ObjectOutputStream(buffer);↵

5

                ObjectOutput out = new ObjectOutputStream(buffer);↵

11

                out.writeObject(g1);↵

6

                out.writeObject(a1);↵

12

                out.close();↵

7

                out.close();↵

13

                ObjectInput in = new ObjectInputStream(↵

8

                ObjectInput in = new ObjectInputStream(↵

14

                        new ByteArrayInputStream(buffer.toByteArray())↵

9

                    new ByteArrayInputStream(buffer.toByteArray())↵

15

    );↵

10

                );↵

16

                g2 = (MultipleXYSeriesLabelGenerator) in.readObject();↵

11

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

17

                in.close();↵

12

                in.close();↵

18

            }↵

13

            }↵

19

            catch (Exception e) {↵

14

            catch (Exception e) {↵

20

                e.printStackTrace();↵

15

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

21

            }↵

16

            }↵

22

            assertEquals(g1, g2);

17

            assertTrue(a1 == a2);

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