if (doUpdate) { if (!renamedFile.delete()) { log ("Warning: unable to delete temporary file " + renamedFile.getName(), Project.MSG_WARN); } }
if (!directory.exists()) { if (!directory.mkdirs()) { throw new BuildException("Unable to create directory: " + directory.getAbsolutePath()); } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Zip.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/XSLTProcess.java
Method name: void executeMain() Method name: void ensureDirectoryFor(File)
Number of AST nodes: 3 Number of AST nodes: 3
1
if (doUpdate) {
1
if (!directory.exists()) {
2
                    if (!renamedFile.delete()) {
2
            
3
                        log ("Warning: unable to delete temporary file "
4
                            + renamedFile.getName(), Project.MSG_WARN);
5
                    }
6
        
3
if (!directory.mkdirs()) {
4
                throw new BuildException("Unable to create directory: "
5
                                         + directory.getAbsolutePath());
6
            }
7
        }
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons5
  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
    92
    if (doUpdate)
    92
    if (doUpdate)
    2
    if (!directory.exists())
    Differences
    Expression1Expression2Difference
    doUpdate!directory.exists()TYPE_COMPATIBLE_REPLACEMENT
    2
    if (!directory.exists())
    93
    if (!renamedFile.delete())
    93
    if (!renamedFile.delete())
    3
    if (!directory.mkdirs())
    Differences
    Expression1Expression2Difference
    deletemkdirsMETHOD_INVOCATION_NAME_MISMATCH
    renamedFiledirectoryVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression directory.mkdirs() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    if (!directory.mkdirs())
                                                                                                                                                                                        
    4
    throw new BuildException("Unable to create directory: " + directory.getAbsolutePath());
    Preondition Violations
    Unmatched throw new BuildException("Unable to create directory: " + directory.getAbsolutePath());
    4
    throw new BuildException("Unable to create directory: " + directory.getAbsolutePath());
    94
    log("Warning: unable to delete temporary file " + renamedFile.getName(), Project.MSG_WARN);
                                                                                                                                                                                                
    Precondition Violations (2)
    Row Violation
    1Expression directory.mkdirs() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Unmatched throw new BuildException("Unable to create directory: " + directory.getAbsolutePath());