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
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.4
Clones locationClones are declared in the same class
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 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
    return true;
    Preondition Violations
    Unmatched return true;
    4
    return true;
    4
    return "";
    4
    return "";
    Preondition Violations
    Unmatched return "";
                              
    5
    if (!l.endsWith(File.separator))
    5
    if (!l.endsWith(File.separator))
    6
    l += File.separator;
    6
    l += File.separator;
    Precondition Violations (3)
    Row Violation
    1Unmatched return true;
    2Unmatched return "";
    3Clone fragment #1 returns variables l, p , while Clone fragment #2 returns variables l, p