427-63-65

DefaultMultiValueCategoryDataset d1 = new DefaultMultiValueCategoryDataset(); DefaultMultiValueCategoryDataset d2 = new DefaultMultiValueCategoryDataset(); try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(d1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); d2 = (DefaultMultiValueCategoryDataset) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(d1, d2);
TimePeriodValuesCollection c1 = new TimePeriodValuesCollection(); TimePeriodValuesCollection c2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(c1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); c2 = (TimePeriodValuesCollection) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(c1, c2);

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

1

    DefaultMultiValueCategoryDataset d1 ↵

2

                    = new DefaultMultiValueCategoryDataset();↵

3

            DefaultMultiValueCategoryDataset d2 ↵

4

                    = new DefaultMultiValueCategoryDataset();↵

1

    TimePeriodValuesCollection c1 = new TimePeriodValuesCollection();↵

2

            TimePeriodValuesCollection c2 = null;↵

5

            try {↵

3

            try {↵

6

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

4

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

7

                ObjectOutput out = new ObjectOutputStream(buffer);↵

5

                ObjectOutput out = new ObjectOutputStream(buffer);↵

8

                out.writeObject(d1);↵

6

                out.writeObject(c1);↵

9

                out.close();↵

7

                out.close();↵

10

                ObjectInput in = new ObjectInputStream(↵

8

                ObjectInput in = new ObjectInputStream(↵

11

                        new ByteArrayInputStream(buffer.toByteArray()));↵

9

                        new ByteArrayInputStream(buffer.toByteArray()));↵

12

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

10

                c2 = (TimePeriodValuesCollection) in.readObject();↵

13

                in.close();↵

11

                in.close();↵

14

            }↵

12

            }↵

15

            catch (Exception e) {↵

13

            catch (Exception e) {↵

16

                e.printStackTrace();↵

14

                e.printStackTrace();↵

17

            }↵

15

            }↵

18

            assertEquals(d1, d2);

16

            assertEquals(c1, c2);

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
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 | 69

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 11
   Number of unmapped statements in the first code fragment | 0
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 2.2
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       DefaultMultiValueCategoryDataset d1 = new DefaultMultiValueCategoryDataset();

   1 | DefaultMultiValueCategoryDataset d1 = new DefaultMultiValueCategoryDataset();
   1 | TimePeriodValuesCollection c1 = new TimePeriodValuesCollection();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.statistics.DefaultMultiValueCategoryDataset | org.jfree.data.time.TimePeriodValuesCollection | SUBCLASS_TYPE_MISMATCH
   d1 | c1 | VARIABLE_NAME_MISMATCH
   org.jfree.data.statistics.DefaultMultiValueCategoryDataset | org.jfree.data.time.TimePeriodValuesCollection | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.statistics.DefaultMultiValueCategoryDataset | org.jfree.data.time.TimePeriodValuesCollection | SUBCLASS_TYPE_MISMATCH

   1

       TimePeriodValuesCollection c1 = new TimePeriodValuesCollection();

   2

       DefaultMultiValueCategoryDataset d2 = new DefaultMultiValueCategoryDataset();

   2 | DefaultMultiValueCategoryDataset d2 = new DefaultMultiValueCategoryDataset();
   2 | TimePeriodValuesCollection c2 = null;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.statistics.DefaultMultiValueCategoryDataset | org.jfree.data.time.TimePeriodValuesCollection | SUBCLASS_TYPE_MISMATCH
   d2 | c2 | VARIABLE_NAME_MISMATCH
   org.jfree.data.statistics.DefaultMultiValueCategoryDataset | org.jfree.data.time.TimePeriodValuesCollection | SUBCLASS_TYPE_MISMATCH
   new DefaultMultiValueCategoryDataset() | null | TYPE_COMPATIBLE_REPLACEMENT

   2

       TimePeriodValuesCollection c2 = null;

   3

       try

   3

       try

   4

       ByteArrayOutputStream buffer = new ByteArrayOutputStream();

   4

       ByteArrayOutputStream buffer = new ByteArrayOutputStream();

   5

       ObjectOutput out = new ObjectOutputStream(buffer);

   5

       ObjectOutput out = new ObjectOutputStream(buffer);

   6

       out.writeObject(d1);

   6 | out.writeObject(d1);
   6 | out.writeObject(c1);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   d1 | c1 | VARIABLE_NAME_MISMATCH
   org.jfree.data.statistics.DefaultMultiValueCategoryDataset | org.jfree.data.time.TimePeriodValuesCollection | SUBCLASS_TYPE_MISMATCH

   6

       out.writeObject(c1);

   7

       out.close();

   7

       out.close();

   8

       ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));

   8

       ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));

   9

       d2 = (DefaultMultiValueCategoryDataset)in.readObject();

   9 | d2 = (DefaultMultiValueCategoryDataset)in.readObject();
   9 | c2 = (TimePeriodValuesCollection)in.readObject();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   d2 | c2 | VARIABLE_NAME_MISMATCH
   org.jfree.data.statistics.DefaultMultiValueCategoryDataset | org.jfree.data.time.TimePeriodValuesCollection | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.statistics.DefaultMultiValueCategoryDataset | org.jfree.data.time.TimePeriodValuesCollection | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression (DefaultMultiValueCategoryDataset)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression (TimePeriodValuesCollection)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   9

       c2 = (TimePeriodValuesCollection)in.readObject();

   10

       in.close();

   10

       in.close();

   11

       assertEquals(d1, d2);

   11 | assertEquals(d1, d2);
   11 | assertEquals(c1, c2);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   d1 | c1 | VARIABLE_NAME_MISMATCH
   org.jfree.data.statistics.DefaultMultiValueCategoryDataset | org.jfree.data.time.TimePeriodValuesCollection | SUBCLASS_TYPE_MISMATCH
   d2 | c2 | VARIABLE_NAME_MISMATCH
   org.jfree.data.statistics.DefaultMultiValueCategoryDataset | org.jfree.data.time.TimePeriodValuesCollection | SUBCLASS_TYPE_MISMATCH

   11

       assertEquals(c1, c2);

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Expression (DefaultMultiValueCategoryDataset)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression (TimePeriodValuesCollection)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted