115-1-8

KeyedObjects2D ko2D1 = new KeyedObjects2D(); ko2D1.addObject(new Double(234.2), "Row1", "Col1"); ko2D1.addObject(null, "Row1", "Col2"); ko2D1.addObject(new Double(345.9), "Row2", "Col1"); ko2D1.addObject(new Double(452.7), "Row2", "Col2"); KeyedObjects2D ko2D2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(ko2D1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); ko2D2 = (KeyedObjects2D) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(ko2D1, ko2D2);
DefaultTableXYDataset d1 = new DefaultTableXYDataset(); d1.addSeries(createSeries2()); DefaultTableXYDataset 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 = (DefaultTableXYDataset) 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/data/junit/KeyedObjects2DTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/TableXYDatasetTests.java
Method name: `void testSerialization()` |  | Method name: `void testSerialization()`
Number of AST nodes: 15 |  | Number of AST nodes: 12

1

    KeyedObjects2D ko2D1 = new KeyedObjects2D();↵

1

    DefaultTableXYDataset d1 = new DefaultTableXYDataset();↵

2

            ko2D1.addObject(new Double(234.2), "Row1", "Col1");↵

2

            d1.add↵

3

            ko2D1.addObject(null, "Row1", "Col2");↵

4

            ko2D1.addObject(new Double(345.9), "Row2", "Col1");↵

5

            ko2D1.addObject(new Double(452.7), "Row2", "Col2");↵

6

            KeyedObjects2D ko2D↵

3

    Series(createSeries2());↵

7

    2 = null;↵

4

            DefaultTableXYDataset d2 = null;↵

8

            try {↵

5

            try {↵

9

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

6

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

10

                ObjectOutput out = new ObjectOutputStream(buffer);↵

7

                ObjectOutput out = new ObjectOutputStream(buffer);↵

11

                out.writeObject(ko2D1);↵

8

                out.writeObject(d1);↵

12

                out.close();↵

9

                out.close();↵

13

                ObjectInput in = new ObjectInputStream(↵

10

                ObjectInput in = new ObjectInputStream(↵

14

                        new ByteArrayInputStream(buffer.toByteArray())↵

11

                    new ByteArrayInputStream(buffer.toByteArray())↵

15

    );↵

12

                );↵

16

                ko2D2 = (KeyedObjects2D) in.readObject();↵

13

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

17

                in.close();↵

14

                in.close();↵

18

            }↵

15

            }↵

19

            catch (Exception e) {↵

16

            catch (Exception e) {↵

20

                e.printStackTrace();↵

17

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

21

            }↵

18

            }↵

22

            assertEquals(ko2D1, ko2D2);

19

            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