if (defaultLoadOptions == null || defaultLoadOptions.isEmpty()) { doLoad(inputSource, options); } else if (options == null) { doLoad(inputSource, defaultLoadOptions); } else { Map<Object, Object> mergedOptions = new HashMap<Object, Object>(defaultLoadOptions); mergedOptions.putAll(options); doLoad(inputSource, mergedOptions); }
if (defaultLoadOptions == null || defaultLoadOptions.isEmpty()) { doLoad(node, options); } else if (options == null) { doLoad(node, defaultLoadOptions); } else { Map<Object, Object> mergedOptions = new HashMap<Object, Object>(defaultLoadOptions); mergedOptions.putAll(options); doLoad(node, mergedOptions); }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLResourceImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLResourceImpl.java
Method name: void load(InputSource, Map) Method name: void load(Node, Map)
Number of AST nodes: 7 Number of AST nodes: 7
1
if (defaultLoadOptions == null || defaultLoadOptions.isEmpty())
1
if (defaultLoadOptions == null || defaultLoadOptions.isEmpty())
2
        {
2
        {
3
          doLoad(inputSource, options);
3
          doLoad(node, options);
4
        }
4
        }
5
        else if (options == null)
5
        else if (options == null)
6
        {
6
        {
7
          doLoad(inputSource, defaultLoadOptions);
7
          doLoad(node, defaultLoadOptions);
8
        }
8
        }
9
        else
9
        else
10
        {
10
        {
11
          Map<Object, Object> mergedOptions = new HashMap<Object, Object>(defaultLoadOptions);
11
          Map<Object, Object> mergedOptions = new HashMap<Object, Object>(defaultLoadOptions);
12
          mergedOptions.putAll(options);
12
          mergedOptions.putAll(options);
13
  
13
  
14
          doLoad(inputSource, mergedOptions);
14
          doLoad(node, mergedOptions);
15
        }
15
        }
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.5
Clones locationClones are declared in the same class
Number of node comparisons41
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    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.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    9
    if (defaultLoadOptions == null || defaultLoadOptions.isEmpty())
    9
    if (defaultLoadOptions == null || defaultLoadOptions.isEmpty())
    10
    doLoad(inputSource, options);
    10
    doLoad(inputSource, options);
    10
    doLoad(node, options);
    Differences
    Expression1Expression2Difference
    inputSourcenodeVARIABLE_NAME_MISMATCH
    org.xml.sax.InputSourceorg.w3c.dom.NodeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.xml.sax.InputSource of variable inputSource does not match with type org.w3c.dom.Node of variable node
    • Make classes org.xml.sax.InputSource and org.w3c.dom.Node extend a common superclass
    10
    doLoad(node, options);
    11
    else if (options == null)
    11
    else if (options == null)
    11
    else if (options == null)
    Differences
    Expression1Expression2Difference
    java.util.Map<,>java.util.Map<,>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Map<,> of variable options does not match with type java.util.Map<,> of variable options
    • Make classes java.util.Map<,> and java.util.Map<,> extend a common superclass
    11
    else if (options == null)
    12
    doLoad(inputSource, defaultLoadOptions);
    12
    doLoad(inputSource, defaultLoadOptions);
    12
    doLoad(node, defaultLoadOptions);
    Differences
    Expression1Expression2Difference
    inputSourcenodeVARIABLE_NAME_MISMATCH
    org.xml.sax.InputSourceorg.w3c.dom.NodeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.xml.sax.InputSource of variable inputSource does not match with type org.w3c.dom.Node of variable node
    • Make classes org.xml.sax.InputSource and org.w3c.dom.Node extend a common superclass
    12
    doLoad(node, defaultLoadOptions);
    else
    else
    13
    Map<Object, Object> mergedOptions = new HashMap<Object, Object>(defaultLoadOptions);
    13
    Map<Object, Object> mergedOptions = new HashMap<Object, Object>(defaultLoadOptions);
    14
    mergedOptions.putAll(options);
    14
    mergedOptions.putAll(options);
    14
    mergedOptions.putAll(options);
    Differences
    Expression1Expression2Difference
    java.util.Map<,>java.util.Map<,>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Map<,> of variable options does not match with type java.util.Map<,> of variable options
    • Make classes java.util.Map<,> and java.util.Map<,> extend a common superclass
    14
    mergedOptions.putAll(options);
    15
    doLoad(inputSource, mergedOptions);
    15
    doLoad(inputSource, mergedOptions);
    15
    doLoad(node, mergedOptions);
    Differences
    Expression1Expression2Difference
    inputSourcenodeVARIABLE_NAME_MISMATCH
    org.xml.sax.InputSourceorg.w3c.dom.NodeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.xml.sax.InputSource of variable inputSource does not match with type org.w3c.dom.Node of variable node
    • Make classes org.xml.sax.InputSource and org.w3c.dom.Node extend a common superclass
    15
    doLoad(node, mergedOptions);
    Precondition Violations (5)
    Row Violation
    1Type org.xml.sax.InputSource of variable inputSource does not match with type org.w3c.dom.Node of variable node
    2Type java.util.Map<,> of variable options does not match with type java.util.Map<,> of variable options
    3Type org.xml.sax.InputSource of variable inputSource does not match with type org.w3c.dom.Node of variable node
    4Type java.util.Map<,> of variable options does not match with type java.util.Map<,> of variable options
    5Type org.xml.sax.InputSource of variable inputSource does not match with type org.w3c.dom.Node of variable node