Element e2 = null; if (uri.equals("")) { e2 = doc.createElement(name); } else { e2 = doc.createElementNS(uri, qName); } e.appendChild(e2); return new Child(e2);
Element e = null; if (uri.equals("")) { e = doc.createElement(name); } else { e = doc.createElementNS(uri, qName); } fragment.appendChild(e); return new Child(e);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/XMLFragment.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/XMLFragment.java
Method name: Object createDynamicElement(String, String, String) Method name: Object createDynamicElement(String, String, String)
Number of AST nodes: 6 Number of AST nodes: 6
1
Element e2 = null;
1
Element e = null;
2
            if (uri.equals("")) {
2
        if (uri.equals("")) {
3
                e2 = doc.createElement(name);
3
            e = doc.createElement(name);
4
            } else {
4
        } else {
5
                e2 = doc.createElementNS(uri, qName);
5
            e = doc.createElementNS(uri, qName);
6
            }
6
        }
7
            e.appendChild(e2);
7
        fragment.appendChild(e);
8
            return new Child(e2);
8
        return new Child(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.1
Clones locationClones are in the same java file
Number of node comparisons18
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Element e2 = null;
    1
    Element e2 = null;
    1
    Element e = null;
    Differences
    Expression1Expression2Difference
    e2eVARIABLE_NAME_MISMATCH
    1
    Element e = null;
    2
    if (uri.equals(""))
    2
    if (uri.equals(""))
    3
    e2 = doc.createElement(name);
    3
    e2 = doc.createElement(name);
    3
    e = doc.createElement(name);
    Differences
    Expression1Expression2Difference
    e2eVARIABLE_NAME_MISMATCH
    3
    e = doc.createElement(name);
    else
    else
    4
    e2 = doc.createElementNS(uri, qName);
    4
    e2 = doc.createElementNS(uri, qName);
    4
    e = doc.createElementNS(uri, qName);
    Differences
    Expression1Expression2Difference
    e2eVARIABLE_NAME_MISMATCH
    4
    e = doc.createElementNS(uri, qName);
    5
    e.appendChild(e2);
    5
    e.appendChild(e2);
    5
    fragment.appendChild(e);
    Differences
    Expression1Expression2Difference
    e2eVARIABLE_NAME_MISMATCH
    efragmentVARIABLE_NAME_MISMATCH
    org.w3c.dom.Elementorg.w3c.dom.DocumentFragmentVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.w3c.dom.Element of variable e does not match with type org.w3c.dom.DocumentFragment of variable fragment
    • Make classes org.w3c.dom.Element and org.w3c.dom.DocumentFragment extend a common superclass
    5
    fragment.appendChild(e);
    6
    return new Child(e2);
    6
    return new Child(e2);
    6
    return new Child(e);
    Differences
    Expression1Expression2Difference
    e2eVARIABLE_NAME_MISMATCH
    6
    return new Child(e);
    Precondition Violations (1)
    Row Violation
    1Type org.w3c.dom.Element of variable e does not match with type org.w3c.dom.DocumentFragment of variable fragment