if (resource.startsWith("/")) { resource = resource.substring(1); } else { resource = "org/apache/tools/ant/taskdefs/optional/junit/" + resource; } File f = LoaderUtils.getResourceSource(getClass().getClassLoader(), resource); if (f != null) { log("Found " + f.getAbsolutePath(), Project.MSG_DEBUG); antRuntimeClasses.createPath().setLocation(f); return true; } else { log("Couldn\'t find " + resource, Project.MSG_DEBUG); return false; }
if (resource.startsWith("/")) { resource = resource.substring(1); } else { resource = "org/apache/tools/ant/taskdefs/optional/jdepend/" + resource; } File f = LoaderUtils.getResourceSource(getClass().getClassLoader(), resource); if (f != null) { log("Found " + f.getAbsolutePath(), Project.MSG_DEBUG); runtimeClasses.createPath().setLocation(f); } else { log("Couldn\'t find " + resource, Project.MSG_DEBUG); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
Method name: boolean addClasspathEntry(String) Method name: void addClasspathEntry(String)
Number of AST nodes: 10 Number of AST nodes: 8
1
if (resource.startsWith("/")) {
1
if (resource.startsWith("/")) {
2
            resource = resource.substring(1);
2
            resource = resource.substring(1);
3
        } else {
3
        } else {
4
            resource = "org/apache/tools/ant/taskdefs/optional/junit/"
4
            resource = "org/apache/tools/ant/taskdefs/optional/jdepend/"
5
                + resource;
5
                + resource;
6
        }
6
        }
7
        File f = LoaderUtils.getResourceSource(getClass().getClassLoader(),
7
        File f = LoaderUtils.getResourceSource(getClass().getClassLoader(),
8
                                               resource);
8
                                               resource);
9
        if (f != null) {
9
        if (f != null) {
10
            log("Found " + f.getAbsolutePath(), Project.MSG_DEBUG);
10
            log("Found " + f.getAbsolutePath(), Project.MSG_DEBUG);
11
            antRuntimeClasses.createPath().setLocation(f);
11
            runtimeClasses.createPath().setLocation(f);
12
            return true;
13
        } else {
12
        } else {
14
            log("Couldn\'t find " + resource, Project.MSG_DEBUG);
13
            log("Couldn\'t find " + resource, Project.MSG_DEBUG);
15
            return false;
16
        }
14
        }
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.3
Clones locationClones are in different classes having the same super class
Number of node comparisons47
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (resource.startsWith("/"))
    1
    if (resource.startsWith("/"))
    2
    resource = resource.substring(1);
    2
    resource = resource.substring(1);
    else
    else
    3
    resource = "org/apache/tools/ant/taskdefs/optional/junit/" + resource;
    3
    resource = "org/apache/tools/ant/taskdefs/optional/junit/" + resource;
    3
    resource = "org/apache/tools/ant/taskdefs/optional/jdepend/" + resource;
    Differences
    Expression1Expression2Difference
    "org/apache/tools/ant/taskdefs/optional/junit/""org/apache/tools/ant/taskdefs/optional/jdepend/"LITERAL_VALUE_MISMATCH
    3
    resource = "org/apache/tools/ant/taskdefs/optional/jdepend/" + resource;
    4
    File f = LoaderUtils.getResourceSource(getClass().getClassLoader(), resource);
    4
    File f = LoaderUtils.getResourceSource(getClass().getClassLoader(), resource);
    4
    File f = LoaderUtils.getResourceSource(getClass().getClassLoader(), resource);
    Differences
    Expression1Expression2Difference
    java.lang.Classjava.lang.ClassVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Class<> of variable getClass() does not match with type java.lang.Class<> of variable getClass()
    • Make classes java.lang.Class and java.lang.Class extend a common superclass
    4
    File f = LoaderUtils.getResourceSource(getClass().getClassLoader(), resource);
    5
    if (f != null)
    5
    if (f != null)
    6
    log("Found " + f.getAbsolutePath(), Project.MSG_DEBUG);
    6
    log("Found " + f.getAbsolutePath(), Project.MSG_DEBUG);
    7
    antRuntimeClasses.createPath().setLocation(f);
    7
    antRuntimeClasses.createPath().setLocation(f);
    7
    runtimeClasses.createPath().setLocation(f);
    Differences
    Expression1Expression2Difference
    antRuntimeClassesruntimeClassesVARIABLE_NAME_MISMATCH
    7
    runtimeClasses.createPath().setLocation(f);
    8
    return true;
    8
    return true;
    Preondition Violations
    Unmatched return true;
                                  
    else
    else
    9
    log("Couldn\'t find " + resource, Project.MSG_DEBUG);
    8
    log("Couldn\'t find " + resource, Project.MSG_DEBUG);
    10
    return false;
    10
    return false;
    Preondition Violations
    Unmatched return false;
                                      
    Precondition Violations (3)
    Row Violation
    1Type java.lang.Class<> of variable getClass() does not match with type java.lang.Class<> of variable getClass()
    2Unmatched return true;
    3Unmatched return false;