if (regularExpression != null) { throw new BuildException( "Only one regular expression is allowed."); } regularExpression = new RegularExpression(); regularExpression.setPattern(pattern);
if (subs != null) { throw new BuildException("Only one substitution expression is " + "allowed"); } subs = new Substitution(); subs.setExpression(replace);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/condition/Matches.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
Method name: void setPattern(String) Method name: void setReplace(String)
Number of AST nodes: 4 Number of AST nodes: 4
1
if (regularExpression != null) {
1
if (subs != null) {
2
            throw new BuildException(
2
            throw new BuildException(
3
                "Only one regular expression is 
3
"Only one substitution expression is "
4
allowed.");
4
                                     + "allowed");
5
        }
5
        }
6
        regularExpression = new RegularExpression();
6
        subs = new Substitution();
7
        regularExpression.setPattern(pattern);
7
        subs.setExpression(replace);
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 having the same super class
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    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.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (regularExpression != null)
    1
    if (regularExpression != null)
    1
    if (subs != null)
    Differences
    Expression1Expression2Difference
    regularExpressionsubsVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.types.RegularExpressionorg.apache.tools.ant.types.SubstitutionSUBCLASS_TYPE_MISMATCH
    1
    if (subs != null)
    2
    throw new BuildException("Only one regular expression is allowed.");
    2
    throw new BuildException("Only one regular expression is allowed.");
    2
    throw new BuildException("Only one substitution expression is " + "allowed");
    Differences
    Expression1Expression2Difference
    "Only one regular expression is allowed.""Only one substitution expression is " + "allowed"TYPE_COMPATIBLE_REPLACEMENT
    2
    throw new BuildException("Only one substitution expression is " + "allowed");
    3
    regularExpression = new RegularExpression();
    3
    regularExpression = new RegularExpression();
    3
    subs = new Substitution();
    Differences
    Expression1Expression2Difference
    regularExpressionsubsVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.types.RegularExpressionorg.apache.tools.ant.types.SubstitutionSUBCLASS_TYPE_MISMATCH
    org.apache.tools.ant.types.RegularExpressionorg.apache.tools.ant.types.SubstitutionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression regularExpression is a field being modified, and thus it cannot be parameterized
    Expression subs is a field being modified, and thus it cannot be parameterized
    3
    subs = new Substitution();
    4
    regularExpression.setPattern(pattern);
    4
    regularExpression.setPattern(pattern);
    4
    subs.setExpression(replace);
    Differences
    Expression1Expression2Difference
    setPatternsetExpressionMETHOD_INVOCATION_NAME_MISMATCH
    patternreplaceVARIABLE_NAME_MISMATCH
    regularExpressionsubsVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.types.RegularExpressionorg.apache.tools.ant.types.SubstitutionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression regularExpression.setPattern(pattern) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression subs.setExpression(replace) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression regularExpression.setPattern(pattern) is a void method call, and thus it cannot be parameterized
    Expression subs.setExpression(replace) is a void method call, and thus it cannot be parameterized
    Expression regularExpression cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression subs cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    subs.setExpression(replace);
    Precondition Violations (8)
    Row Violation
    1Expression regularExpression is a field being modified, and thus it cannot be parameterized
    2Expression subs is a field being modified, and thus it cannot be parameterized
    3Expression regularExpression.setPattern(pattern) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression subs.setExpression(replace) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression regularExpression.setPattern(pattern) is a void method call, and thus it cannot be parameterized
    6Expression subs.setExpression(replace) is a void method call, and thus it cannot be parameterized
    7Expression regularExpression cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression subs cannot be parameterized, because it has dependencies to/from statements that will be extracted