if (initialized) { return; } options = convertRegexOptions(flags); if (from == null) { throw new BuildException("Missing pattern in replaceregex"); } regularExpression = new RegularExpression(); regularExpression.setPattern(from); regexp = regularExpression.getRegexp(getProject()); if (to == null) { to = ""; } substitution = new Substitution(); substitution.setExpression(to);
if (initialized) { return; } options = convertRegexOptions(flags); if (from == null) { throw new BuildException("Missing from in containsregex"); } regularExpression = new RegularExpression(); regularExpression.setPattern(from); regexp = regularExpression.getRegexp(getProject()); if (to == null) { return; } substitution = new Substitution(); substitution.setExpression(to);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/filters/TokenFilter.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/filters/TokenFilter.java
Method name: void initialize() Method name: void initialize()
Number of AST nodes: 12 Number of AST nodes: 12
1
if (initialized) {
1
if (initialized) {
2
                return;
2
                return;
3
            }
3
            }
4
            options = convertRegexOptions(flags);
4
            options = convertRegexOptions(flags);
5
            if (from == null) {
5
            if (from == null) {
6
                throw new BuildException("Missing pattern in replaceregex");
6
                throw new BuildException("Missing from in containsregex");
7
            }
7
            }
8
            regularExpression = new RegularExpression();
8
            regularExpression = new RegularExpression();
9
            regularExpression.setPattern(from);
9
            regularExpression.setPattern(from);
10
            regexp = regularExpression.getRegexp(getProject());
10
            regexp = regularExpression.getRegexp(getProject());
11
            if (to == null) {
11
            if (to == null) {
12
                to = "";
12
                return;
13
            }
13
            }
14
            substitution = new Substitution();
14
            substitution = new Substitution();
15
            substitution.setExpression(to);
15
            substitution.setExpression(to);
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 the same java file
Number of node comparisons41
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (initialized)
    1
    if (initialized)
    2
    return;
    2
    return;
    3
    options = convertRegexOptions(flags);
    3
    options = convertRegexOptions(flags);
    4
    if (from == null)
    4
    if (from == null)
    5
    throw new BuildException("Missing pattern in replaceregex");
    5
    throw new BuildException("Missing pattern in replaceregex");
    5
    throw new BuildException("Missing from in containsregex");
    Differences
    Expression1Expression2Difference
    "Missing pattern in replaceregex""Missing from in containsregex"LITERAL_VALUE_MISMATCH
    5
    throw new BuildException("Missing from in containsregex");
    6
    regularExpression = new RegularExpression();
    6
    regularExpression = new RegularExpression();
    7
    regularExpression.setPattern(from);
    7
    regularExpression.setPattern(from);
    8
    regexp = regularExpression.getRegexp(getProject());
    8
    regexp = regularExpression.getRegexp(getProject());
    9
    if (to == null)
    9
    if (to == null)
                          
    10
    return;
    Preondition Violations
    Unmatched return;
    10
    return;
    10
    to = "";
    10
    to = "";
    Preondition Violations
    Unmatched statement to=""; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                        
    11
    substitution = new Substitution();
    11
    substitution = new Substitution();
    12
    substitution.setExpression(to);
    12
    substitution.setExpression(to);
    Precondition Violations (2)
    Row Violation
    1Unmatched return;
    2Unmatched statement to=""; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted