String name = entry.getName();
if (entry.isDirectory()) {
name = trimSeparator(name);
dirEntries.put(name, r);
if (match(name)) {
matchDirEntries.put(name, r);
}
} else {
fileEntries.put(name, r);
if (match(name)) {
matchFileEntries.put(name, r);
}
}
String name = entry.getName();
if (entry.isDirectory()) {
name = trimSeparator(name);
dirEntries.put(name, r);
if (match(name)) {
matchDirEntries.put(name, r);
}
} else {
fileEntries.put(name, r);
if (match(name)) {
matchFileEntries.put(name, r);
}
}
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/TarScanner.java
|
|
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/ZipScanner.java
|
Method name: void fillMapsFromArchive(Resource, String, Map, Map, Map, Map)
|
|
Method name: void fillMapsFromArchive(Resource, String, Map, Map, Map, Map)
|
Number of AST nodes: 9
|
|
Number of AST nodes: 9
|
|
1 | String name = entry.getName();↵ | | 1 | String name = entry.getName();↵
|
2 | if (entry.isDirectory()) {↵ | | 2 | if (entry.isDirectory()) {↵
|
3 | name = trimSeparator(name);↵ | | 3 | name = trimSeparator(name);↵
|
4 | dirEntries.put(name, r);↵ | | 4 | dirEntries.put(name, r);↵
|
5 | if (match(name)) {↵ | | 5 | if (match(name)) {↵
|
6 | matchDirEntries.put(name, r);↵ | | 6 | matchDirEntries.put(name, r);↵
|
7 | }↵ | | 7 | }↵
|
8 | } else {↵ | | 8 | } else {↵
|
9 | fileEntries.put(name, r);↵ | | 9 | fileEntries.put(name, r);↵
|
10 | if (match(name)) {↵ | | 10 | if (match(name)) {↵
|
11 | matchFileEntries.put(name, r);↵ | | 11 | matchFileEntries.put(name, r);↵
|
12 | }↵ | | 12 | }↵
|
13 | } | | 13 | }
|
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.4 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 31 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 9 |
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) | 8.0 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
8 | String name = entry.getName(); | | 14 | String name = entry.getName(); |
9 | if (entry.isDirectory()) | | 15 | if (entry.isDirectory()) |
10 | name = trimSeparator(name); | | 16 | name = trimSeparator(name); |
11 | | | 17 | |
12 | | | 18 | |
13 | matchDirEntries.put(name, r); | | 19 | matchDirEntries.put(name, r); |
| | | | |
14 | fileEntries.put(name, r); | | 20 | fileEntries.put(name, r); |
15 | | | 21 | |
16 | matchFileEntries.put(name, r); | | 22 | matchFileEntries.put(name, r); |
Precondition Violations (2)
Row |
Violation |
1 | Type org.apache.tools.tar.TarEntry of variable entry does not match with type org.apache.tools.zip.ZipEntry of variable entry |
2 | Type org.apache.tools.tar.TarEntry of variable entry does not match with type org.apache.tools.zip.ZipEntry of variable entry |