ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(f1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); f2 = (ArcDialFrame) in.readObject(); in.close();
ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(chart); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); chart2 = (JFreeChart) in.readObject(); in.close();
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/dial/junit/ArcDialFrameTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/XYPlotTests.java
Method name: void testSerialization() Method name: void testSerialization3()
Number of AST nodes: 7 Number of AST nodes: 7
1
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
1
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
2
            ObjectOutput out = new ObjectOutputStream(buffer);
2
            ObjectOutput out = new ObjectOutputStream(buffer);
3
            out.writeObject(f1);
3
            out.writeObject(chart);
4
            out.close();
4
            out.close();
5
            ObjectInput in = new ObjectInputStream(
5
            ObjectInput in = new ObjectInputStream(
6
                    new ByteArrayInputStream(buffer.toByteArray())
6
                new ByteArrayInputStream(buffer.toByteArray())
7
);
7
            );
8
            f2 = (ArcDialFrame) in.readObject();
8
            chart2 = (JFreeChart) in.readObject();
9
            in.close();
9
            in.close();
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are in different classes having the same super class
Number of node comparisons28
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    5
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    5
    ObjectOutput out = new ObjectOutputStream(buffer);
    6
    ObjectOutput out = new ObjectOutputStream(buffer);
    6
    out.writeObject(f1);
    6
    out.writeObject(f1);
    7
    out.writeObject(chart);
    Differences
    Expression1Expression2Difference
    f1chartVARIABLE_NAME_MISMATCH
    org.jfree.chart.plot.dial.ArcDialFrameorg.jfree.chart.JFreeChartVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.plot.dial.ArcDialFrame of variable f1 does not match with type org.jfree.chart.JFreeChart of variable chart
    • Make classes org.jfree.chart.plot.dial.ArcDialFrame and org.jfree.chart.JFreeChart extend a common superclass
    7
    out.writeObject(chart);
    7
    out.close();
    8
    out.close();
    8
    ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
    9
    ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
    9
    f2 = (ArcDialFrame)in.readObject();
    9
    f2 = (ArcDialFrame)in.readObject();
    Preondition Violations
    Unmatched statement f2=(ArcDialFrame)in.readObject(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                            
                                                                                  
    10
    chart2 = (JFreeChart)in.readObject();
    Preondition Violations
    Unmatched statement chart2=(JFreeChart)in.readObject(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    chart2 = (JFreeChart)in.readObject();
    10
    in.close();
    11
    in.close();
    Precondition Violations (3)
    Row Violation
    1Type org.jfree.chart.plot.dial.ArcDialFrame of variable f1 does not match with type org.jfree.chart.JFreeChart of variable chart
    2Unmatched statement f2=(ArcDialFrame)in.readObject(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement chart2=(JFreeChart)in.readObject(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted