List list = (List) prefixMapping.get(prefix); if (list == null) { list = new ArrayList(); prefixMapping.put(prefix, list); } list.add(uri);
ArrayList al = (ArrayList) nsURIByElement.get(element); if (al == null) { al = new ArrayList(); nsURIByElement.put(element, al); } al.add(uri);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/helper/AntXMLContext.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/DOMElementWriter.java
Method name: void startPrefixMapping(String, String) Method name: void addNSDefinition(Element, String)
Number of AST nodes: 5 Number of AST nodes: 5
1
List list = (List) prefixMapping.get(prefix);
1
ArrayList al = (ArrayList) nsURIByElement.get(element);
2
        if (list == null) {
2
        if (al == null) {
3
            list = new ArrayList();
3
            al = new ArrayList();
4
            prefixMapping.put(prefix, list);
4
            nsURIByElement.put(element, al);
5
        }
5
        }
6
        list.add(uri);
6
        al.add(uri);
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 comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                  
    1
    ArrayList al = (ArrayList)nsURIByElement.get(element);
    1
    List list = (List)prefixMapping.get(prefix);
                                                                                              
    2
    if (list == null)
    2
    if (list == null)
    2
    if (al == null)
    Differences
    Expression1Expression2Difference
    listalVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.ArrayListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List of variable list does not match with type java.util.ArrayList of variable al
    • Make classes java.util.List and java.util.ArrayList extend a common superclass
    2
    if (al == null)
                                                
    3
    al = new ArrayList();
    Preondition Violations
    Unmatched statement al=new ArrayList(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    al = new ArrayList();
    3
    list = new ArrayList();
    3
    list = new ArrayList();
    Preondition Violations
    Unmatched statement list=new ArrayList(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                    
    4
    prefixMapping.put(prefix, list);
    4
    prefixMapping.put(prefix, list);
    4
    nsURIByElement.put(element, al);
    Differences
    Expression1Expression2Difference
    prefixelementVARIABLE_NAME_MISMATCH
    java.lang.Stringorg.w3c.dom.ElementVARIABLE_TYPE_MISMATCH
    prefixMappingnsURIByElementVARIABLE_NAME_MISMATCH
    java.util.Mapjava.util.HashMapVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable prefix does not match with type org.w3c.dom.Element of variable element
    • Make classes java.lang.String and org.w3c.dom.Element extend a common superclass
    Type java.util.Map of variable prefixMapping does not match with type java.util.HashMap of variable nsURIByElement
    • Make classes java.util.Map and java.util.HashMap extend a common superclass
    4
    nsURIByElement.put(element, al);
    5
    list.add(uri);
    5
    list.add(uri);
    5
    al.add(uri);
    Differences
    Expression1Expression2Difference
    listalVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.ArrayListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List of variable list does not match with type java.util.ArrayList of variable al
    • Make classes java.util.List and java.util.ArrayList extend a common superclass
    5
    al.add(uri);
    Precondition Violations (6)
    Row Violation
    1Type java.util.List of variable list does not match with type java.util.ArrayList of variable al
    2Unmatched statement al=new ArrayList(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement list=new ArrayList(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type java.lang.String of variable prefix does not match with type org.w3c.dom.Element of variable element
    5Type java.util.Map of variable prefixMapping does not match with type java.util.HashMap of variable nsURIByElement
    6Type java.util.List of variable list does not match with type java.util.ArrayList of variable al