in = source.getInputStream();
out = dest.getOutputStream();
byte[] buffer = new byte[FileUtils.BUF_SIZE];
int count = 0;
do {
out.write(buffer, 0, count);
count = in.read(buffer, 0, buffer.length);
} while (count != -1);
byte[] buffer = new byte[8 * 1024];
int count = 0;
do {
zOut.write(buffer, 0, count);
count = in.read(buffer, 0, buffer.length);
} while (count != -1);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/ResourceUtils.java
|
|
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Pack.java
|
Method name: void copyResource(Resource, Resource, FilterSetCollection, Vector, boolean, boolean, String, String, Project)
|
|
Method name: void zipFile(InputStream, OutputStream)
|
Number of AST nodes: 7
|
|
Number of AST nodes: 5
|
|
1 | in = source.getInputStream();↵ | | |
|
2 | out = dest.getOutputStream();↵ | | |
|
|
3 | byte[] buffer = new byte[FileUtils.BUF_SIZE];↵ | | 1 | byte[] buffer = new byte[↵
|
4 | ↵ | | 2 | 8 * 1024];↵
|
5 | int count = 0;↵ | | 3 | int count = 0;↵
|
6 | do {↵ | | 4 | do {↵
|
7 | out.write(buffer, 0, count);↵ | | 5 | zOut.write(buffer, 0, count);↵
|
8 | count = in.read(buffer, 0, buffer.length);↵ | | 6 | count = in.read(buffer, 0, buffer.length);↵
|
9 | } while (count != -1); | | 7 | } while (count != -1);
|
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 in different classes |
Number of node comparisons | 17 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 2.5 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
72 | byte[] buffer = new byte[FileUtils.BUF_SIZE]; | | 1 | byte[] buffer = new byte[8 * 1024]; |
73 | int count = 0; | | 2 | int count = 0; |
76 | do while(count != -1) | | 5 | do while(count != -1) |
74 | out.write(buffer, 0, count); | | 3 | zOut.write(buffer, 0, count); |
75 | count = in.read(buffer, 0, buffer.length); | | 4 | count = in.read(buffer, 0, buffer.length); |
Precondition Violations (0)
Row |
Violation |