while (e.hasMoreElements()) { RuntimeConfigurable childWrapper = (RuntimeConfigurable) e.nextElement(); UnknownElement childElement = new UnknownElement(childWrapper.getElementTag()); parentElement.addChild(childElement); childElement.setProject(getProject()); childElement.setRuntimeConfigurableWrapper(childWrapper); childWrapper.setProxy(childElement); replaceChildren(childWrapper, childElement); }
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/Task.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
Method name: void replaceChildren(RuntimeConfigurable, UnknownElement) Method name: void startTestSuite(JUnitTest)
Number of AST nodes: 8 Number of AST nodes: 7
1
while (e.hasMoreElements()) {
2
            RuntimeConfigurable childWrapper =
3
                (RuntimeConfigurable
1
Enumeration e = props.propertyNames();
2
            while (e.hasMoreElements()) {
4
) e.nextElement();
3
                String name = (String) e.nextElement();
5
            UnknownElement childElement =
4
                Element propElement =
6
                new UnknownElement(childWrapper.getElementTag());
7
            parentElement.addChild(childElement);
8
            childElement.setProject(getProject()
5
 doc.createElement(PROPERTY);
9
);
6
                propElement.setAttribute(ATTR_NAME, name);
10
            childElement.setRuntimeConfigurableWrapper(childWrapper);
7
                propElement.set
11
            childWrapper.setProxy(childElement);
12
            replaceChildren(childWrapper, child
8
Attribute(ATTR_VALUE, props.getProperty(name));
13
Element);
9
                propsElement.appendChild(propElement);
14
        }
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 statements1
    Number of unmapped statements in the first code fragment7
    Number of unmapped statements in the second code fragment6
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                    
    12
    Enumeration e = props.propertyNames();
    2
    while (e.hasMoreElements())
    13
    while (e.hasMoreElements())
    3
    RuntimeConfigurable childWrapper = (RuntimeConfigurable)e.nextElement();
    3
    RuntimeConfigurable childWrapper = (RuntimeConfigurable)e.nextElement();
    Preondition Violations
    Unmatched statement RuntimeConfigurable childWrapper=(RuntimeConfigurable)e.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                      
    4
    UnknownElement childElement = new UnknownElement(childWrapper.getElementTag());
    4
    UnknownElement childElement = new UnknownElement(childWrapper.getElementTag());
    Preondition Violations
    Unmatched statement UnknownElement childElement=new UnknownElement(childWrapper.getElementTag()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                    
    5
    parentElement.addChild(childElement);
    5
    parentElement.addChild(childElement);
    Preondition Violations
    Unmatched statement parentElement.addChild(childElement); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                    
    6
    childElement.setProject(getProject());
    6
    childElement.setProject(getProject());
    Preondition Violations
    Unmatched statement childElement.setProject(getProject()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                      
    7
    childElement.setRuntimeConfigurableWrapper(childWrapper);
    7
    childElement.setRuntimeConfigurableWrapper(childWrapper);
    Preondition Violations
    Unmatched statement childElement.setRuntimeConfigurableWrapper(childWrapper); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                            
    8
    childWrapper.setProxy(childElement);
    8
    childWrapper.setProxy(childElement);
    Preondition Violations
    Unmatched statement childWrapper.setProxy(childElement); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                  
    9
    replaceChildren(childWrapper, childElement);
    9
    replaceChildren(childWrapper, childElement);
    Preondition Violations
    Unmatched statement replaceChildren(childWrapper,childElement); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                
                                                                                    
    14
    String name = (String)e.nextElement();
    Preondition Violations
    Unmatched statement String name=(String)e.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    14
    String name = (String)e.nextElement();
                                                                                                            
    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);
                                                                                                                                      
    17
    propElement.setAttribute(ATTR_VALUE, props.getProperty(name));
                                                                                        
    18
    propsElement.appendChild(propElement);
    Precondition Violations (9)
    Row Violation
    1Unmatched statement RuntimeConfigurable childWrapper=(RuntimeConfigurable)e.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement UnknownElement childElement=new UnknownElement(childWrapper.getElementTag()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement parentElement.addChild(childElement); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement childElement.setProject(getProject()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement childElement.setRuntimeConfigurableWrapper(childWrapper); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement childWrapper.setProxy(childElement); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement replaceChildren(childWrapper,childElement); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement String name=(String)e.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched 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