if (inFile.exists() && inFile.isDirectory()) { String message = "srcfile is a directory!"; if (failonerror) { throw new BuildException(message, getLocation()); } else { log(message, Project.MSG_ERR); } return; } if (inFile.exists() && !inFile.canRead()) { String message = "Can not read from the specified srcfile!"; if (failonerror) { throw new BuildException(message, getLocation()); } else { log(message, Project.MSG_ERR); } return; }
if (destfile.exists() && destfile.isDirectory()) { String message = "destfile is a directory!"; if (failonerror) { throw new BuildException(message, getLocation()); } else { log(message, Project.MSG_ERR); } return; } if (destfile.exists() && !destfile.canWrite()) { String message = "Can not write to the specified destfile!"; if (failonerror) { throw new BuildException(message, getLocation()); } else { log(message, Project.MSG_ERR); } return; }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/EchoProperties.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
Method name: void execute() Method name: void execute()
Number of AST nodes: 12 Number of AST nodes: 12
1
if (inFile.exists() && inFile.isDirectory()) {
1
if (destfile.exists() && destfile.isDirectory()) {
2
                String message = "srcfile is a directory!";
2
                    String message = "destfile is a directory!";
3
                if (failonerror) {
3
                    if (failonerror) {
4
                    throw new BuildException(message, getLocation());
4
                        throw new BuildException(message, getLocation());
5
                } else {
5
                    } else {
6
                    log(message, Project.MSG_ERR);
6
                        log(message, Project.MSG_ERR);
7
                }
7
                
8
    }
8
                return;
9
                    return;
9
            }
10
            
11
    }
10
            if (inFile.exists() && !inFile.canRead()) {
12
                if (destfile.exists() && !destfile.canWrite()) {
11
                String message =
13
                    String message =
12
 "Can not read from the specified srcfile!";
14
                        "Can not write to the specified destfile!";
13
                if (failonerror) {
15
                    if (failonerror) {
14
                    throw new BuildException(message, getLocation());
16
                        throw new BuildException(message, getLocation());
15
                } else {
17
                    } else {
16
                    log(message, Project.MSG_ERR);
18
                        log(message, Project.MSG_ERR);
17
                }
19
                
20
    }
18
                return;
21
                    return;
19
            }
22
                }
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.6
Clones locationClones are in the same method
Number of node comparisons48
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    7
    if (inFile.exists() && inFile.isDirectory())
    7
    if (inFile.exists() && inFile.isDirectory())
    35
    if (destfile.exists() && destfile.isDirectory())
    Differences
    Expression1Expression2Difference
    inFiledestfileVARIABLE_NAME_MISMATCH
    inFiledestfileVARIABLE_NAME_MISMATCH
    35
    if (destfile.exists() && destfile.isDirectory())
    8
    String message = "srcfile is a directory!";
    8
    String message = "srcfile is a directory!";
    36
    String message = "destfile is a directory!";
    Differences
    Expression1Expression2Difference
    "srcfile is a directory!""destfile is a directory!"LITERAL_VALUE_MISMATCH
    36
    String message = "destfile is a directory!";
    9
    if (failonerror)
    37
    if (failonerror)
    10
    throw new BuildException(message, getLocation());
    38
    throw new BuildException(message, getLocation());
    else
    else
    11
    log(message, Project.MSG_ERR);
    39
    log(message, Project.MSG_ERR);
    12
    return;
    12
    return;
    40
    return;
    Preondition Violations
    Conditional return;
    Conditional return;
    40
    return;
    13
    if (inFile.exists() && !inFile.canRead())
    13
    if (inFile.exists() && !inFile.canRead())
    41
    if (destfile.exists() && !destfile.canWrite())
    Differences
    Expression1Expression2Difference
    inFiledestfileVARIABLE_NAME_MISMATCH
    canReadcanWriteMETHOD_INVOCATION_NAME_MISMATCH
    inFiledestfileVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression inFile.canRead() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression destfile.canWrite() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    41
    if (destfile.exists() && !destfile.canWrite())
    14
    String message = "Can not read from the specified srcfile!";
    14
    String message = "Can not read from the specified srcfile!";
    42
    String message = "Can not write to the specified destfile!";
    Differences
    Expression1Expression2Difference
    "Can not read from the specified srcfile!""Can not write to the specified destfile!"LITERAL_VALUE_MISMATCH
    42
    String message = "Can not write to the specified destfile!";
    15
    if (failonerror)
    43
    if (failonerror)
    16
    throw new BuildException(message, getLocation());
    44
    throw new BuildException(message, getLocation());
    else
    else
    17
    log(message, Project.MSG_ERR);
    45
    log(message, Project.MSG_ERR);
    18
    return;
    18
    return;
    46
    return;
    Preondition Violations
    Conditional return;
    Conditional return;
    46
    return;
    Precondition Violations (6)
    Row Violation
    1Conditional return;
    2Conditional return;
    3Expression inFile.canRead() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression destfile.canWrite() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Conditional return;
    6Conditional return;