for (int i = 0; i < propertyList.size(); i++) { final Property prop = (Property) propertyList.elementAt(i); setProperty(prop.getName(), prop.getValue()); }
for (int i = 0; i < attributeList.size(); i++) { Attribute feature = (Attribute) attributeList.elementAt(i); setFeature(feature.getName(), feature.getValue()); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java
Method name: void initValidator() Method name: void initValidator()
Number of AST nodes: 3 Number of AST nodes: 3
1
for (int i = 0; i < propertyList.size(); i++) {
1
for (int i = 0; i < attributeList.size(); i++) {
2
                final Property prop = (Property) propertyList.elementAt(i);
2
                Attribute feature = (Attribute) attributeList.elementAt(i);
3
                setProperty(prop.getName(), prop.getValue());
3
                setFeature(feature.getName(), feature.getValue());
4
            }
4
            }
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 comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)2.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    10
    for (int i = 0; i < propertyList.size(); i++)
    10
    for (int i = 0; i < propertyList.size(); i++)
    7
    for (int i = 0; i < attributeList.size(); i++)
    Differences
    Expression1Expression2Difference
    propertyListattributeListVARIABLE_NAME_MISMATCH
    7
    for (int i = 0; i < attributeList.size(); i++)
                                                                                                                          
    8
    Attribute feature = (Attribute)attributeList.elementAt(i);
    Preondition Violations
    Unmatched statement Attribute feature=(Attribute)attributeList.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    Attribute feature = (Attribute)attributeList.elementAt(i);
                                                                                                            
    9
    setFeature(feature.getName(), feature.getValue());
    Preondition Violations
    Unmatched statement setFeature(feature.getName(),feature.getValue()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    9
    setFeature(feature.getName(), feature.getValue());
    11
    final Property prop = (Property)propertyList.elementAt(i);
    11
    final Property prop = (Property)propertyList.elementAt(i);
    Preondition Violations
    Unmatched statement final Property prop=(Property)propertyList.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                            
    12
    setProperty(prop.getName(), prop.getValue());
    12
    setProperty(prop.getName(), prop.getValue());
    Preondition Violations
    Unmatched statement setProperty(prop.getName(),prop.getValue()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                    
    Precondition Violations (5)
    Row Violation
    1Unmatched statement Attribute feature=(Attribute)attributeList.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement setFeature(feature.getName(),feature.getValue()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    3Unmatched statement final Property prop=(Property)propertyList.elementAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement setProperty(prop.getName(),prop.getValue()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    5The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero