142-5-52

AxisLocation location1 = AxisLocation.BOTTOM_OR_RIGHT; AxisLocation location2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(location1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); location2 = (AxisLocation) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(location1, location2); boolean same = location1 == location2; assertEquals(true, same);
SimpleHistogramBin b1 = new SimpleHistogramBin(1.0, 2.0, false, true); b1.setItemCount(123); SimpleHistogramBin b2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(b1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); b2 = (SimpleHistogramBin) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(b1, b2);

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

1

    AxisLocation location1 = AxisLocation.BOTTOM_OR_RIGHT;↵

2

            AxisLocation location↵

1

    SimpleHistogramBin b1 = new SimpleHistogramBin(1.0, 2.0, false, true);↵

2

            b1.setItemCount(123);↵

3

    2 = null;↵

3

            SimpleHistogramBin b2 = null;        ↵

4

            try {↵

4

            try {↵

5

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

5

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

6

                ObjectOutput out = new ObjectOutputStream(buffer);↵

6

                ObjectOutput out = new ObjectOutputStream(buffer);↵

7

                out.writeObject(location1);↵

7

                out.writeObject(b1);↵

8

                out.close();↵

8

                out.close();↵

9

                ObjectInput in = new ObjectInputStream(↵

9

                ObjectInput in = new ObjectInputStream(↵

10

                        new ByteArrayInputStream(buffer.toByteArray())↵

10

                    new ByteArrayInputStream(buffer.toByteArray())↵

11

    );↵

11

                );↵

12

                location2 = (AxisLocation) in.readObject();↵

12

                b2 = (SimpleHistogramBin) in.readObject();↵

13

                in.close();↵

13

                in.close();↵

14

            }↵

14

            }↵

15

            catch (Exception e) {↵

15

            catch (Exception e) {↵

16

                e.printStackTrace();↵

16

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

17

            }↵

17

            }↵

18

            assertEquals(location1, location2);↵

18

            assertEquals(↵

19

            boolean same = location1 == location2;↵

20

            assertEquals(true, same);

19

    b1, b2);

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