Document doc = parent.getOwnerDocument(); Element e = doc.createElement(name); parent.appendChild(e); return e;
Document doc = parent.getOwnerDocument(); CDATASection c = doc.createCDATASection(content); parent.appendChild(c);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/DOMUtils.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/DOMUtils.java
Method name: Element createChildElement(Element, String) Method name: void appendCDATA(Element, String)
Number of AST nodes: 4 Number of AST nodes: 3
1
Document doc = parent.getOwnerDocument();
1
Document doc = parent.getOwnerDocument();
2
        Element e = doc.createElement(name);
2
        CDATASection c = doc.createCDATASection(content);
3
        parent.appendChild(e);
3
        parent.appendChild(c);
4
        return e;
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 declared in the same class
Number of node comparisons12
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    Document doc = parent.getOwnerDocument();
    1
    Document doc = parent.getOwnerDocument();
                                                                                                        
    2
    CDATASection c = doc.createCDATASection(content);
    Preondition Violations
    Unmatched statement CDATASection c=doc.createCDATASection(content); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    CDATASection c = doc.createCDATASection(content);
    2
    Element e = doc.createElement(name);
    2
    Element e = doc.createElement(name);
    Preondition Violations
    Unmatched statement Element e=doc.createElement(name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                              
    3
    parent.appendChild(e);
    3
    parent.appendChild(e);
    3
    parent.appendChild(c);
    Differences
    Expression1Expression2Difference
    ecVARIABLE_NAME_MISMATCH
    org.w3c.dom.Elementorg.w3c.dom.CDATASectionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.w3c.dom.Element of variable e does not match with type org.w3c.dom.CDATASection of variable c
    • Make classes org.w3c.dom.Element and org.w3c.dom.CDATASection extend a common superclass
    3
    parent.appendChild(c);
    4
    return e;
    4
    return e;
    Preondition Violations
    Unmatched return e;
                            
    Precondition Violations (4)
    Row Violation
    1Unmatched statement CDATASection c=doc.createCDATASection(content); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement Element e=doc.createElement(name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type org.w3c.dom.Element of variable e does not match with type org.w3c.dom.CDATASection of variable c
    4Unmatched return e;