Document doc = parent.getOwnerDocument(); CDATASection c = doc.createCDATASection(content); parent.appendChild(c);
Document doc = parent.getOwnerDocument(); Text t = doc.createTextNode(content); parent.appendChild(t);
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: void appendCDATA(Element, String) Method name: void appendText(Element, String)
Number of AST nodes: 3 Number of AST nodes: 3
1
Document doc = parent.getOwnerDocument();
1
Document doc = parent.getOwnerDocument();
2
        CDATASection c = doc.createCDATASection(content);
2
        Text t = doc.createTextNode(content);
3
        parent.appendChild(c);
3
        parent.appendChild(t);
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 comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    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
    1
    Document doc = parent.getOwnerDocument();
    1
    Document doc = parent.getOwnerDocument();
                                                                                
    2
    Text t = doc.createTextNode(content);
    Preondition Violations
    Unmatched statement Text t=doc.createTextNode(content); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    Text t = doc.createTextNode(content);
    2
    CDATASection c = doc.createCDATASection(content);
    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
                                                                                                        
    3
    parent.appendChild(c);
    3
    parent.appendChild(c);
    3
    parent.appendChild(t);
    Differences
    Expression1Expression2Difference
    ctVARIABLE_NAME_MISMATCH
    org.w3c.dom.CDATASectionorg.w3c.dom.TextVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.w3c.dom.CDATASection of variable c does not match with type org.w3c.dom.Text of variable t
    • Make classes org.w3c.dom.CDATASection and org.w3c.dom.Text extend a common superclass
    3
    parent.appendChild(t);
    Precondition Violations (3)
    Row Violation
    1Unmatched statement Text t=doc.createTextNode(content); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched 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
    3Type org.w3c.dom.CDATASection of variable c does not match with type org.w3c.dom.Text of variable t