while (e.hasMoreElements()) { String name = (String) e.nextElement(); String className = props.getProperty(name); AntTypeDefinition def = new AntTypeDefinition(); def.setName(name); def.setClassName(className); def.setClassLoader(classLoader); antTypeTable.put(name, def); }
Enumeration e = props.propertyNames(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); Element propElement = doc.createElement(PROPERTY); propElement.setAttribute(ATTR_NAME, name); propElement.setAttribute(ATTR_VALUE, props.getProperty(name)); propsElement.appendChild(propElement); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/ComponentHelper.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
Method name: void initTypes() Method name: void startTestSuite(JUnitTest)
Number of AST nodes: 8 Number of AST nodes: 7
1
Enumeration e = props.propertyNames();
1
while (e.hasMoreElements()) {
2
            while (e.hasMoreElements()) {
2
            String name = (String) e.nextElement();
3
                String name = (String) e.nextElement();
3
            String className = props.getProperty(name);
4
            
4
            AntTypeDefinition def = new AntTypeDefinition();
5
            def.setName(
5
    Element propElement = doc.createElement(PROPERTY);
6
name);
6
                propElement.setAttribute(ATTR_NAME, name);
7
            def.setClassName(className);
7
             
8
            def.setClassLoader(classLoader);
9
            antTypeTable.put(name, def);
8
   propElement.setAttribute(ATTR_VALUE, props.getProperty(name));
9
                propsElement.appendChild(propElement);
10
        }
10
            }
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 comparisons48
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment6
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)1.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                    
    12
    Enumeration e = props.propertyNames();
    4
    while (e.hasMoreElements())
    13
    while (e.hasMoreElements())
    5
    String name = (String)e.nextElement();
    14
    String name = (String)e.nextElement();
    6
    String className = props.getProperty(name);
    6
    String className = props.getProperty(name);
    Preondition Violations
    Unmatched statement String className=props.getProperty(name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                            
    7
    AntTypeDefinition def = new AntTypeDefinition();
    7
    AntTypeDefinition def = new AntTypeDefinition();
    Preondition Violations
    Unmatched statement AntTypeDefinition def=new AntTypeDefinition(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                      
    8
    def.setName(name);
    8
    def.setName(name);
    Preondition Violations
    Unmatched statement def.setName(name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                              
    9
    def.setClassName(className);
    9
    def.setClassName(className);
    Preondition Violations
    Unmatched statement def.setClassName(className); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                  
    10
    def.setClassLoader(classLoader);
    10
    def.setClassLoader(classLoader);
    Preondition Violations
    Unmatched statement def.setClassLoader(classLoader); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                            
    11
    antTypeTable.put(name, def);
    11
    antTypeTable.put(name, def);
    Preondition Violations
    Unmatched statement antTypeTable.put(name,def); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                  
                                                                                                            
    15
    Element propElement = doc.createElement(PROPERTY);
    Preondition Violations
    Unmatched statement Element propElement=doc.createElement(PROPERTY); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    15
    Element propElement = doc.createElement(PROPERTY);
                                                                                              
    16
    propElement.setAttribute(ATTR_NAME, name);
    Preondition Violations
    Unmatched statement propElement.setAttribute(ATTR_NAME,name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    16
    propElement.setAttribute(ATTR_NAME, name);
                                                                                                                                      
    17
    propElement.setAttribute(ATTR_VALUE, props.getProperty(name));
    Preondition Violations
    Unmatched statement propElement.setAttribute(ATTR_VALUE,props.getProperty(name)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    17
    propElement.setAttribute(ATTR_VALUE, props.getProperty(name));
                                                                                        
    18
    propsElement.appendChild(propElement);
    Precondition Violations (9)
    Row Violation
    1Unmatched statement String className=props.getProperty(name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement AntTypeDefinition def=new AntTypeDefinition(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement def.setName(name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement def.setClassName(className); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement def.setClassLoader(classLoader); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement antTypeTable.put(name,def); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement Element propElement=doc.createElement(PROPERTY); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement propElement.setAttribute(ATTR_NAME,name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched statement propElement.setAttribute(ATTR_VALUE,props.getProperty(name)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted