if (value.length() == 0) { throw new BuildException("Begin token cannot " + "be empty"); } beginToken = params[i].getValue().charAt(0);
if ("endtoken".equals(name)) { if (value.length() == 0) { throw new BuildException("End token cannot " + "be empty"); } endToken = params[i].getValue().charAt(0); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/filters/ReplaceTokens.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/filters/ReplaceTokens.java
Method name: void initialize() Method name: void initialize()
Number of AST nodes: 3 Number of AST nodes: 4
1
if ("endtoken".equals(name)) {
1
if (value.length() == 0) {
2
                            if (value.length() == 0) {
2
                                throw new BuildException("Begin token cannot "
3
                                throw new BuildException("End token cannot "
3
                                    + "be empty");
4
                                    + "be empty");
4
                            }
5
                            }
5
                            beginToken = params[i].getValue().charAt(0);
6
                            endToken = params[i].getValue().charAt(0);
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 the same method
Number of node comparisons7
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    10
    if (value.length() == 0)
    14
    if (value.length() == 0)
    11
    throw new BuildException("Begin token cannot " + "be empty");
    11
    throw new BuildException("Begin token cannot " + "be empty");
    15
    throw new BuildException("End token cannot " + "be empty");
    Differences
    Expression1Expression2Difference
    "Begin token cannot ""End token cannot "LITERAL_VALUE_MISMATCH
    15
    throw new BuildException("End token cannot " + "be empty");
    12
    beginToken = params[i].getValue().charAt(0);
    12
    beginToken = params[i].getValue().charAt(0);
    16
    endToken = params[i].getValue().charAt(0);
    Differences
    Expression1Expression2Difference
    beginTokenendTokenVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression beginToken is a field being modified, and thus it cannot be parameterized
    Expression endToken is a field being modified, and thus it cannot be parameterized
    16
    endToken = params[i].getValue().charAt(0);
    Precondition Violations (2)
    Row Violation
    1Expression beginToken is a field being modified, and thus it cannot be parameterized
    2Expression endToken is a field being modified, and thus it cannot be parameterized