142-14-37

OHLCDataItem i1 = new OHLCDataItem( new Date(1L), 1.0, 2.0, 3.0, 4.0, 5.0 ); OHLCDataItem 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 = (OHLCDataItem) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(i1, i2);
TimePeriodValue tpv1 = new TimePeriodValue(new Day(30, 7, 2003), 55.75); TimePeriodValue tpv2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(tpv1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); tpv2 = (TimePeriodValue) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(tpv1, tpv2);

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

1

    OHLCDataItem i1 = new OHLCDataItem(↵

2

                new Date(1L), 1.0, 2.0, 3.0, 4.0, 5.0↵

1

    TimePeriodValue tpv1 = new TimePeriodValue(new Day(30, 7, 2003), 55.↵

3

            );↵

2

    75);↵

4

            OHLCDataItem i2 = null;↵

3

            TimePeriodValue tpv2 = null;↵

5

            ↵

6

            try {↵

4

            try {↵

7

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

5

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

8

                ObjectOutput out = new ObjectOutputStream(buffer);↵

6

                ObjectOutput out = new ObjectOutputStream(buffer);↵

9

                out.writeObject(i1);↵

7

                out.writeObject(tpv1);↵

10

                out.close();↵

8

                out.close();↵

11

                ObjectInput in = new ObjectInputStream(↵

9

                ObjectInput in = new ObjectInputStream(↵

12

                    new ByteArrayInputStream(buffer.toByteArray())↵

10

                    new ByteArrayInputStream(buffer.toByteArray())↵

13

                );↵

11

                );↵

14

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

12

                tpv2 = (TimePeriodValue) 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(i1, i2);

18

            assertEquals(tpv1, tpv2);

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.2
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 1