363-1-3

StrokeMap m1 = new StrokeMap(); m1.put("K1", new BasicStroke(1.1f)); m1.put("K2", new BasicStroke(2.2f)); StrokeMap 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 = (StrokeMap) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(m1, m2);
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/junit/StrokeMapTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/statistics/junit/SimpleHistogramBinTests.java
Method name: `void testSerialization2()` |  | Method name: `void testSerialization()`
Number of AST nodes: 13 |  | Number of AST nodes: 12

1

    StrokeMap m1 = new StrokeMap();↵

1

    S↵

2

            m1.put("K1", new BasicStroke(1.1f));↵

2

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

3

            m1.put("K2", new BasicStroke(2.2f));↵

3

            b1.↵

4

            StrokeMap m↵

4

    setItemCount(123);↵

5

    2 = null;↵

5

            SimpleHistogramBin b2 = null;        ↵

6

            try {↵

6

            try {↵

7

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

7

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

8

                ObjectOutput out = new ObjectOutputStream(buffer);↵

8

                ObjectOutput out = new ObjectOutputStream(buffer);↵

9

                out.writeObject(m1);↵

9

                out.writeObject(b1);↵

10

                out.close();↵

10

                out.close();↵

11

                ObjectInput in = new ObjectInputStream(↵

11

                ObjectInput in = new ObjectInputStream(↵

12

    new ByteArrayInputStream(↵

12

                    new ByteArrayInputStream(↵

13

                        buffer.toByteArray())↵

13

    buffer.toByteArray())↵

14

    );↵

14

                );↵

15

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

15

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

16

                in.close();↵

16

                in.close();↵

17

            }↵

17

            }↵

18

            catch (Exception e) {↵

18

            catch (Exception e) {↵

19

                e.printStackTrace();↵

19

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

20

            }↵

20

            }↵

21

            assertEquals(m1, m2);

21

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