try {
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();
}
catch (Exception e) {
fail(e.toString());
}
try {
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();
}
catch (Exception e) {
fail(e.toString());
}
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/XYPlotTests.java
|
|
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/XYPlotTests.java
|
Method name: void testSerialization3()
|
|
Method name: void testSerialization4()
|
Number of AST nodes: 8
|
|
Number of AST nodes: 8
|
|
1 | try {↵ | | 1 | try {↵
|
2 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵ | | 2 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵
|
3 | ObjectOutput out = new ObjectOutputStream(buffer);↵ | | 3 | ObjectOutput out = new ObjectOutputStream(buffer);↵
|
4 | out.writeObject(chart);↵ | | 4 | out.writeObject(chart);↵
|
5 | out.close();↵ | | 5 | out.close();↵
|
|
6 | ObjectInput in = new ObjectInputStream(↵ | | 6 | ObjectInput in = new ObjectInputStream(↵
|
7 | new ByteArrayInputStream(buffer.toByteArray())↵ | | 7 | new ByteArrayInputStream(buffer.toByteArray())↵
|
8 | );↵ | | 8 | );↵
|
9 | chart2 = (JFreeChart) in.readObject();↵ | | 9 | chart2 = (JFreeChart) in.readObject();↵
|
10 | in.close();↵ | | 10 | in.close();↵
|
11 | }↵ | | 11 | }↵
|
12 | catch (Exception e) {↵ | | 12 | catch (Exception e) {↵
|
13 | fail(e.toString());↵ | | 13 | fail(e.toString());↵
|
14 | } | | 14 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 64 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 8 |
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) | 11.6 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
4 | try | | 9 | try |
5 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | | 10 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); |
6 | ObjectOutput out = new ObjectOutputStream(buffer); | | 11 | ObjectOutput out = new ObjectOutputStream(buffer); |
7 | | | 12 | |
8 | | | 13 | |
9 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); | | 14 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); |
10 | chart2 = (JFreeChart)in.readObject(); | | 15 | chart2 = (JFreeChart)in.readObject(); |
11 | | | 16 | |
Precondition Violations (0)
Row |
Violation |