while (e.hasMoreElements()) { String propertyName = (String) e.nextElement(); String value = systemP.getProperty(propertyName); this.setPropertyInternal(propertyName, value); }
while (e.hasMoreElements()) { String arg = (String) e.nextElement(); String value = (String) definedProps.get(arg); project.setUserProperty(arg, value); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/Project.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/Main.java
Method name: void setSystemProperties() Method name: void runBuild(ClassLoader)
Number of AST nodes: 4 Number of AST nodes: 4
1
while (e.hasMoreElements()) {
1
while (e.hasMoreElements()) {
2
            String propertyName = (String) e.nextElement();
2
                    String arg = (String) e.nextElement();
3
            String value = systemP.getProperty(propertyName);
3
                    String value = 
4
            this.setPropertyInternal(propertyName
4
(String) definedProps.get(arg);
5
, value);
5
                    project.setUserProperty(arg, value);
6
        }
6
                }
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
Number of node comparisons16
  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)1.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    while (e.hasMoreElements())
    28
    while (e.hasMoreElements())
    4
    String propertyName = (String)e.nextElement();
    4
    String propertyName = (String)e.nextElement();
    29
    String arg = (String)e.nextElement();
    Differences
    Expression1Expression2Difference
    propertyNameargVARIABLE_NAME_MISMATCH
    29
    String arg = (String)e.nextElement();
    5
    String value = systemP.getProperty(propertyName);
    5
    String value = systemP.getProperty(propertyName);
    30
    String value = (String)definedProps.get(arg);
    Differences
    Expression1Expression2Difference
    systemP.getProperty(propertyName)(String)definedProps.get(arg)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression systemP.getProperty(propertyName) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (String)definedProps.get(arg) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    30
    String value = (String)definedProps.get(arg);
    6
    this.setPropertyInternal(propertyName, value);
    6
    this.setPropertyInternal(propertyName, value);
    31
    project.setUserProperty(arg, value);
    Differences
    Expression1Expression2Difference
    setPropertyInternalsetUserPropertyMETHOD_INVOCATION_NAME_MISMATCH
    propertyNameargVARIABLE_NAME_MISMATCH
    thisprojectTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.setPropertyInternal(propertyName,value) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method setPropertyInternal
    Expression project.setUserProperty(arg,value) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.setPropertyInternal(propertyName,value) is a void method call, and thus it cannot be parameterized
    Expression project.setUserProperty(arg,value) is a void method call, and thus it cannot be parameterized
    31
    project.setUserProperty(arg, value);
    Precondition Violations (6)
    Row Violation
    1Expression systemP.getProperty(propertyName) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression (String)definedProps.get(arg) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression this.setPropertyInternal(propertyName,value) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression project.setUserProperty(arg,value) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression this.setPropertyInternal(propertyName,value) is a void method call, and thus it cannot be parameterized
    6Expression project.setUserProperty(arg,value) is a void method call, and thus it cannot be parameterized