try {
inExpect = new BufferedInputStream(new FileInputStream(expect));
inResult = new BufferedInputStream(new FileInputStream(result));
int expectedByte = inExpect.read();
while (expectedByte != -1) {
assertEquals(expectedByte, inResult.read());
expectedByte = inExpect.read();
}
assertEquals("End of file", -1, inResult.read());
} finally {
if (inResult != null) {
inResult.close();
}
if (inExpect != null) {
inExpect.close();
}
}
try {
inExpect = new BufferedInputStream(new FileInputStream(expect));
inResult = new BufferedInputStream(new FileInputStream(result));
int expectedByte = inExpect.read();
while (expectedByte != -1) {
assertEquals(expectedByte, inResult.read());
expectedByte = inExpect.read();
}
assertEquals("End of file", -1, inResult.read());
} finally {
if (inResult != null) {
inResult.close();
}
if (inExpect != null) {
inExpect.close();
}
}
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java
|
|
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/taskdefs/ReplaceTest.java
|
Method name: void assertEqualContent(File, File)
|
|
Method name: void assertEqualContent(File, File)
|
Number of AST nodes: 8
|
|
Number of AST nodes: 8
|
|
1 | try {↵ | | 1 | try {↵
|
2 | inExpect = new BufferedInputStream(new FileInputStream(expect));↵ | | 2 | inExpect = new BufferedInputStream(new FileInputStream(expect));↵
|
3 | inResult = new BufferedInputStream(new FileInputStream(result));↵ | | 3 | inResult = new BufferedInputStream(new FileInputStream(result));↵
|
|
4 | int expectedByte = inExpect.read();↵ | | 4 | int expectedByte = inExpect.read();↵
|
5 | while (expectedByte != -1) {↵ | | 5 | while (expectedByte != -1) {↵
|
6 | assertEquals(expectedByte, inResult.read());↵ | | 6 | assertEquals(expectedByte, inResult.read());↵
|
7 | expectedByte = inExpect.read();↵ | | 7 | expectedByte = inExpect.read();↵
|
8 | }↵ | | 8 | }↵
|
9 | assertEquals("End of file", -1, inResult.read());↵ | | 9 | assertEquals("End of file", -1, inResult.read());↵
|
10 | } finally {↵ | | 10 | } finally {↵
|
11 | if (inResult != null) {↵ | | 11 | if (inResult != null) {↵
|
12 | inResult.close();↵ | | 12 | inResult.close();↵
|
13 | }↵ | | 13 | }↵
|
14 | if (inExpect != null) {↵ | | 14 | if (inExpect != null) {↵
|
15 | inExpect.close();↵ | | 15 | inExpect.close();↵
|
16 | }↵ | | 16 | }↵
|
17 | } | | 17 | }
|
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.4 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 34 |
-
{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) | 2.7 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
5 | try | | 5 | try |
6 | inExpect = new BufferedInputStream(new FileInputStream(expect)); | | 6 | inExpect = new BufferedInputStream(new FileInputStream(expect)); |
7 | inResult = new BufferedInputStream(new FileInputStream(result)); | | 7 | inResult = new BufferedInputStream(new FileInputStream(result)); |
8 | int expectedByte = inExpect.read(); | | 8 | int expectedByte = inExpect.read(); |
9 | while (expectedByte != -1) | | 9 | while (expectedByte != -1) |
10 | assertEquals(expectedByte, inResult.read()); | | 10 | assertEquals(expectedByte, inResult.read()); |
11 | expectedByte = inExpect.read(); | | 11 | expectedByte = inExpect.read(); |
12 | assertEquals("End of file", -1, inResult.read()); | | 12 | assertEquals("End of file", -1, inResult.read()); |
Precondition Violations (0)
Row |
Violation |