if (props != null) { 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); } }
Properties systemP = System.getProperties(); Enumeration e = systemP.propertyNames(); while (e.hasMoreElements()) { String propertyName = (String) e.nextElement(); String value = systemP.getProperty(propertyName); this.setPropertyInternal(propertyName, value); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/Project.java
Method name: void startTestSuite(JUnitTest) Method name: void setSystemProperties()
Number of AST nodes: 8 Number of AST nodes: 6
1
if (props != null) {
2
    
1
Properties systemP = System.getProperties();
3
        Enumeration e = props.propertyNames();
2
        Enumeration e = systemP.propertyNames();
4
            while (e.hasMoreElements()) {
3
        while (e.hasMoreElements()) {
5
                String name = (String) e.nextElement();
4
            String propertyName = (String) e.nextElement();
6
                Element propElement = doc.createElement(PROPERTY);
5
            
7
                propElement.setAttribute(ATTR_NAME, name);
8
                propElement.setAttribute(ATTR_VALUE, prop
6
String value = systemP.getProperty(propertyName);
9
s.getProperty(name));
7
            this.setProperty
10
                propsElement.appendChild(propElement);
11
            }
8
Internal(propertyName, value);
12
        }
9
        }
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 comparisons26
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                              
    1
    Properties systemP = System.getProperties();
    12
    Enumeration e = props.propertyNames();
    12
    Enumeration e = props.propertyNames();
    2
    Enumeration e = systemP.propertyNames();
    Differences
    Expression1Expression2Difference
    propssystemPVARIABLE_NAME_MISMATCH
    2
    Enumeration e = systemP.propertyNames();
    13
    while (e.hasMoreElements())
    3
    while (e.hasMoreElements())
    14
    String name = (String)e.nextElement();
    14
    String name = (String)e.nextElement();
    4
    String propertyName = (String)e.nextElement();
    Differences
    Expression1Expression2Difference
    namepropertyNameVARIABLE_NAME_MISMATCH
    4
    String propertyName = (String)e.nextElement();
                                                                                                        
    5
    String value = systemP.getProperty(propertyName);
    Preondition Violations
    Unmatched statement String value=systemP.getProperty(propertyName); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    String value = systemP.getProperty(propertyName);
                                                                                                    
    6
    this.setPropertyInternal(propertyName, value);
    Preondition Violations
    Unmatched statement this.setPropertyInternal(propertyName,value); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    this.setPropertyInternal(propertyName, value);
    15
    Element propElement = doc.createElement(PROPERTY);
    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
                                                                                                            
    16
    propElement.setAttribute(ATTR_NAME, name);
    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
                                                                                              
    17
    propElement.setAttribute(ATTR_VALUE, props.getProperty(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
                                                                                                                                      
    18
    propsElement.appendChild(propElement);
                                                                                        
    Precondition Violations (5)
    Row Violation
    1Unmatched statement String value=systemP.getProperty(propertyName); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement this.setPropertyInternal(propertyName,value); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched 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
    4Unmatched 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
    5Unmatched 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