while ((read = fis1.read(buffer1)) != -1) {
fis2.read(buffer2);
for (int i = 0; i < read; ++i, ++index) {
if (buffer1[i] != buffer2[i]) {
System.out.println("Bytes mismatch:" + name1 + ", " + name2 +
" at byte " + index);
return false;
}
}
}
while ((read = fis1.read(buffer1)) != -1) {
fis2.read(buffer2);
for (int i = 0; i < read; ++i, ++index) {
if (buffer1[i] != buffer2[i]) {
System.out.println("Bytes mismatch:" + name1 + ", " + name2 +
" at byte " + index);
return false;
}
}
}
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/taskdefs/optional/i18n/TranslateTest.java
|
|
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/FilterSetTest.java
|
Method name: boolean compareFiles(String, String)
|
|
Method name: boolean compareFiles(String, String)
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | while ((read = fis1.read(buffer1)) != -1) {↵ | | 1 | while ((read = fis1.read(buffer1)) != -1) {↵
|
2 | fis2.read(buffer2);↵ | | 2 | fis2.read(buffer2);↵
|
3 | for (int i = 0; i < read; ++i, ++index) {↵ | | 3 | for (int i = 0; i < read; ++i, ++index) {↵
|
4 | if (buffer1[i] != buffer2[i]) {↵ | | 4 | if (buffer1[i] != buffer2[i]) {↵
|
5 | System.out.println("Bytes mismatch:" + name1 + ", " + name2 +↵ | | 5 | System.out.println("Bytes mismatch:" + name1 + ", " + name2 +↵
|
6 | " at byte " + index);↵ | | 6 | " at byte " + index);↵
|
7 | return false;↵ | | 7 | return false;↵
|
8 | }↵ | | 8 | }↵
|
9 | }↵ | | 9 | }↵
|
10 | } | | 10 | }
|
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.5 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 16 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 6 |
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.8 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
16 | while ((read = fis1.read(buffer1)) != -1) | | 16 | while ((read = fis1.read(buffer1)) != -1) |
17 | | | 17 | |
18 | for (int i = 0; i < read; ++i, ++index) | | 18 | for (int i = 0; i < read; ++i, ++index) |
19 | if (buffer1[i] != buffer2[i]) | | 19 | if (buffer1[i] != buffer2[i]) |
20 | System.out.println("Bytes mismatch:" + name1 + ", " + name2 + " at byte " + index); | | 20 | System.out.println("Bytes mismatch:" + name1 + ", " + name2 + " at byte " + index); |
21 | | | 21 | |
Precondition Violations (2)
Row |
Violation |
1 | Conditional return false; |
2 | Conditional return false; |