391-6-8

MeterInterval m1 = new MeterInterval("X", new Range(1.0, 2.0)); MeterInterval m2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(m1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); m2 = (MeterInterval) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } boolean b = m1.equals(m2); assertTrue(b);
BarRenderer3D r1 = new BarRenderer3D(); r1.setWallPaint(new GradientPaint(1.0f, 2.0f, Color.red, 4.0f, 3.0f, Color.blue)); BarRenderer3D 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 = (BarRenderer3D) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(r1, r2);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/MeterIntervalTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/category/junit/BarRenderer3DTests.java
Method name: `void testSerialization()` |  | Method name: `void testSerialization()`
Number of AST nodes: 12 |  | Number of AST nodes: 12

1

    MeterInterval m1 = new MeterInterval("X", new Range↵

1

    BarRenderer3D r1 = new BarRenderer3D();↵

2

    (1.0, 2.0));↵

2

            r1.setWallPaint(new GradientPaint(1.0f, 2.0↵

3

            MeterInterval m↵

3

    f, Color.red, 4.0f, 3.0f,↵

4

                    Color.blue));↵

4

    2 = null;↵

5

            BarRenderer3D r2 = null;↵

5

            try {↵

6

            try {↵

6

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

7

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

7

                ObjectOutput out = new ObjectOutputStream(buffer);↵

8

                ObjectOutput out = new ObjectOutputStream(buffer);↵

8

                out.writeObject(m1);↵

9

                out.writeObject(r1);↵

9

                out.close();↵

10

                out.close();↵

10

                ObjectInput in = new ObjectInputStream(↵

11

                ObjectInput in = new ObjectInputStream(↵

11

                    new ByteArrayInputStream(buffer.toByteArray())↵

12

                        new ByteArrayInputStream(buffer.toByteArray())↵

12

                );↵

13

    );↵

13

                m2 = (MeterInterval) in.readObject();↵

14

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

14

                in.close();↵

15

                in.close();↵

15

            }↵

16

            }↵

16

            catch (Exception e) {↵

17

            catch (Exception e) {↵

17

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

18

                ↵

18

            }↵

19

            boolean b = m1.equals(m2);↵

20

            assertTrue(b↵

19

    e.printStackTrace();↵

20

            }↵

21

    );

21

            assertEquals(r1, r2);

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