142-9-47

XYStepRenderer r1 = new XYStepRenderer(); r1.setStepPoint(0.123); XYStepRenderer r2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(r1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); r2 = (XYStepRenderer) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(r1, r2);
DomainOrder d1 = DomainOrder.ASCENDING; DomainOrder 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 = (DomainOrder) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(d1, d2); boolean same = d1 == d2; assertEquals(true, same);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/xy/junit/XYStepRendererTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/junit/DomainOrderTests.java
Method name: `void testSerialization()` |  | Method name: `void testSerialization()`
Number of AST nodes: 12 |  | Number of AST nodes: 13

1

    XYStepRenderer r1 = new XYStepRenderer();↵

1

    DomainOrder d1 = ↵

2

            r1.setStepPoint(0.123);↵

3

            XYStepRender↵

2

    DomainOrder.ASCENDING;↵

4

    er r2 = null;↵

3

            DomainOrder d2 = null;↵

5

            try {↵

4

            try {↵

6

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

5

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

7

                ObjectOutput out = new ObjectOutputStream(buffer);↵

6

                ObjectOutput out = new ObjectOutputStream(buffer);↵

8

                out.writeObject(r1);↵

7

                out.writeObject(d1);↵

9

                out.close();↵

8

                out.close();↵

10

                ObjectInput in = new ObjectInputStream(↵

9

                ObjectInput in = new ObjectInputStream(↵

11

                        new ByteArrayInputStream(buffer.toByteArray())↵

10

                    new ByteArrayInputStream(buffer.toByteArray())↵

12

    );↵

11

                );↵

13

                r2 = (XYStepRenderer) in.readObject();↵

12

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

14

                in.close();↵

13

                in.close();↵

15

            }↵

14

            }↵

16

            catch (Exception e) {↵

15

            catch (Exception e) {↵

17

                e.printStackTrace();↵

16

                ↵

18

            }↵

17

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

18

            }↵

19

            assertEquals(d1, d2);↵

20

            boolean same = d1 == d2;↵

19

            assertEquals(r1, r2);

21

            assertEquals(true, same);

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