while (iten.hasNext()) { Tuple tuple = (Tuple) iten.next(); Element propElement = doc.createElement(PROPERTY); propElement.setAttribute(ATTR_NAME, tuple.key); propElement.setAttribute(ATTR_VALUE, tuple.value); rootElement.appendChild(propElement); }
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/taskdefs/optional/EchoProperties.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java
Method name: void xmlSaveProperties(Properties, OutputStream) Method name: void startTestSuite(JUnitTest)
Number of AST nodes: 6 Number of AST nodes: 5
1
while (iten.hasNext()) {
2
            Tuple tuple = (Tuple) iten.next();
1
String name = (String) e.nextElement();
3
            Element propElement = doc.createElement(PROPERTY);
2
                Element propElement = doc.createElement(PROPERTY);
4
            propElement.setAttribute(ATTR_NAME, tuple.key);
3
                propElement.setAttribute(ATTR_NAME, 
4
name);
5
            propElement.setAttribute(ATTR_VALUE, tuple.value);
5
                propElement.setAttribute(ATTR_VALUE, props.getProperty(name));
6
            rootElement.appendChild(propElement);
6
                propsElement.appendChild(propElement);
7
        }
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.0
Clones locationClones are in different classes
Number of node comparisons26
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    Tuple tuple = (Tuple)iten.next();
    6
    Tuple tuple = (Tuple)iten.next();
    Preondition Violations
    Unmatched statement Tuple tuple=(Tuple)iten.next(); 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();
    7
    Element propElement = doc.createElement(PROPERTY);
    15
    Element propElement = doc.createElement(PROPERTY);
    8
    propElement.setAttribute(ATTR_NAME, tuple.key);
    8
    propElement.setAttribute(ATTR_NAME, tuple.key);
    16
    propElement.setAttribute(ATTR_NAME, name);
    Differences
    Expression1Expression2Difference
    tuple.keynameTYPE_COMPATIBLE_REPLACEMENT
    16
    propElement.setAttribute(ATTR_NAME, name);
    9
    propElement.setAttribute(ATTR_VALUE, tuple.value);
    9
    propElement.setAttribute(ATTR_VALUE, tuple.value);
    17
    propElement.setAttribute(ATTR_VALUE, props.getProperty(name));
    Differences
    Expression1Expression2Difference
    tuple.valueprops.getProperty(name)TYPE_COMPATIBLE_REPLACEMENT
    17
    propElement.setAttribute(ATTR_VALUE, props.getProperty(name));
    10
    rootElement.appendChild(propElement);
    10
    rootElement.appendChild(propElement);
    18
    propsElement.appendChild(propElement);
    Differences
    Expression1Expression2Difference
    rootElementpropsElementVARIABLE_NAME_MISMATCH
    18
    propsElement.appendChild(propElement);
    Precondition Violations (2)
    Row Violation
    1Unmatched statement Tuple tuple=(Tuple)iten.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched 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