ByteArrayOutputStream buffer = new ByteArrayOutputStream();
ObjectOutput out = new ObjectOutputStream(buffer);
out.writeObject(c1);
out.close();
ObjectInput in = new ObjectInputStream(
new ByteArrayInputStream(buffer.toByteArray()));
c2 = (DialCap) in.readObject();
in.close();
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
ObjectOutput out = new ObjectOutputStream(buffer);
out.writeObject(c1);
out.close();
ObjectInput in = new ObjectInputStream(
new ByteArrayInputStream(buffer.toByteArray()));
c2 = (DialCap) in.readObject();
in.close();
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/dial/junit/DialCapTests.java
|
|
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/dial/junit/DialCapTests.java
|
Method name: void testSerialization()
|
|
Method name: void testSerialization()
|
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(c1);↵ | | 3 | out.writeObject(c1);↵
|
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 | c2 = (DialCap) in.readObject();↵ | | 7 | c2 = (DialCap) in.readObject();↵
|
8 | in.close(); | | 8 | in.close();
|
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.0 |
Clones location | Clones are in the same method |
Number of node comparisons | 28 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 7 |
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) | 0.0 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
4 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | | 18 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); |
5 | ObjectOutput out = new ObjectOutputStream(buffer); | | 19 | ObjectOutput out = new ObjectOutputStream(buffer); |
6 | out.writeObject(c1); | | 20 | out.writeObject(c1); |
7 | out.close(); | | 21 | out.close(); |
8 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); | | 22 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); |
9 | c2 = (DialCap)in.readObject(); | | 23 | c2 = (DialCap)in.readObject(); |
10 | in.close(); | | 24 | in.close(); |
Precondition Violations (0)
Row |
Violation |