String l = normalize(leading.getAbsolutePath()).getAbsolutePath();
String p = normalize(path.getAbsolutePath()).getAbsolutePath();
if (l.equals(p)) {
return "";
}
// ensure that l ends with a /
// so we never think /foo was a parent directory of /foobar
if (!l.endsWith(File.separator)) {
l += File.separator;
}
String l = normalize(leading.getAbsolutePath()).getAbsolutePath();
String p = normalize(path.getAbsolutePath()).getAbsolutePath();
if (l.equals(p)) {
return true;
}
// ensure that l ends with a /
// so we never think /foo was a parent directory of /foobar
if (!l.endsWith(File.separator)) {
l += File.separator;
}
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/FileUtils.java
|
|
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/FileUtils.java
|
Method name: String removeLeadingPath(File, File)
|
|
Method name: boolean isLeadingPath(File, File)
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | String l = normalize(leading.getAbsolutePath()).getAbsolutePath();↵ | | 1 | String l = normalize(leading.getAbsolutePath()).getAbsolutePath();↵
|
2 | String p = normalize(path.getAbsolutePath()).getAbsolutePath();↵ | | 2 | String p = normalize(path.getAbsolutePath()).getAbsolutePath();↵
|
3 | if (l.equals(p)) {↵ | | 3 | if (l.equals(p)) {↵
|
4 | return "";↵ | | 4 | return true;↵
|
5 | }↵ | | 5 | }↵
|
|
6 | // ensure that l ends with a /↵ | | 6 | // ensure that l ends with a /↵
|
7 | // so we never think /foo was a parent directory of /foobar↵ | | 7 | // so we never think /foo was a parent directory of /foobar↵
|
8 | if (!l.endsWith(File.separator)) {↵ | | 8 | if (!l.endsWith(File.separator)) {↵
|
9 | l += File.separator;↵ | | 9 | l += File.separator;↵
|
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.4 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 17 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 1.4 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | String l = normalize(leading.getAbsolutePath()).getAbsolutePath(); | | 1 | String l = normalize(leading.getAbsolutePath()).getAbsolutePath(); |
2 | String p = normalize(path.getAbsolutePath()).getAbsolutePath(); | | 2 | String p = normalize(path.getAbsolutePath()).getAbsolutePath(); |
3 | if (l.equals(p)) | | 3 | if (l.equals(p)) |
| | | 4 | |
4 | | | | |
5 | if (!l.endsWith(File.separator)) | | 5 | if (!l.endsWith(File.separator)) |
6 | | | 6 | |
Precondition Violations (3)
Row |
Violation |
1 | Unmatched return true; |
2 | Unmatched return ""; |
3 | Clone fragment #1 returns variables l, p , while Clone fragment #2 returns variables l, p |