for (int i = 0; i < children.length; ++i) { File file = children[i]; // Test here again to avoid method call for non-directories! if (file.isDirectory()) { removedCount += removeEmptyDirectories(file, true); } }
File resource = new File(element, resourceLocation); if (resource.exists()) { return resource; }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Sync.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/depend/AbstractAnalyzer.java
Method name: int removeEmptyDirectories(File, boolean) Method name: File getResourceContainer(String, String[])
Number of AST nodes: 4 Number of AST nodes: 3
1
for (int i = 0; i < children.length; ++i) {
2
                File file = children[i];
3
                // Test here again to avoid method call for non-directories!
1
File resource = new File(element, resourceLocation);
4
                if (file.isDirectory()) {
2
                if (resource.exists()) {
5
                    removedCount += removeEmptyDirectories(file, true);
3
                    return resource;
6
                }
4
                }
7
            }
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.1
Clones locationClones are in different classes
Number of node comparisons7
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    5
    File file = children[i];
    5
    File file = children[i];
    6
    File resource = new File(element, resourceLocation);
    Differences
    Expression1Expression2Difference
    fileresourceVARIABLE_NAME_MISMATCH
    children[i]new File(element,resourceLocation)TYPE_COMPATIBLE_REPLACEMENT
    6
    File resource = new File(element, resourceLocation);
    6
    if (file.isDirectory())
    6
    if (file.isDirectory())
    7
    if (resource.exists())
    Differences
    Expression1Expression2Difference
    isDirectoryexistsMETHOD_INVOCATION_NAME_MISMATCH
    fileresourceVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression file.isDirectory() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression resource.exists() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7
    if (resource.exists())
    7
    removedCount += removeEmptyDirectories(file, true);
    7
    removedCount += removeEmptyDirectories(file, true);
    Preondition Violations
    Unmatched statement removedCount+=removeEmptyDirectories(file,true); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                          
                                          
    8
    return resource;
    Preondition Violations
    Unmatched statement return resource; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return resource;
    8
    return resource;
    Precondition Violations (5)
    Row Violation
    1Expression file.isDirectory() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression resource.exists() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement removedCount+=removeEmptyDirectories(file,true); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement return resource; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched return resource;