ResourceSet resourceSet = createResourceSet(); XMLResource resource = (XMLResource)resourceSet.createResource(XML_URI); if (options != null) { Map<Object, Object> mergedOptions = new HashMap<Object, Object>(loadOptions); mergedOptions.putAll(options); resource.load(node, mergedOptions); } else { resource.load(node, loadOptions); } resourceSet.getPackageRegistry().putAll(registry); return resource;
ResourceSet resourceSet = createResourceSet(); XMLResource resource = (XMLResource)resourceSet.createResource(XML_URI); if (options != null) { Map<Object, Object> mergedOptions = new HashMap<Object, Object>(loadOptions); mergedOptions.putAll(options); resource.load(inputSource, mergedOptions); } else { resource.load(inputSource, loadOptions); } resourceSet.getPackageRegistry().putAll(registry); return resource;
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/util/XMLProcessor.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/util/XMLProcessor.java
Method name: Resource load(Node, Map) Method name: Resource load(InputSource, Map)
Number of AST nodes: 9 Number of AST nodes: 9
1
ResourceSet resourceSet = createResourceSet();
1
ResourceSet resourceSet = createResourceSet();
2
    XMLResource resource = (XMLResource)resourceSet.createResource(XML_URI);
2
    XMLResource resource = (XMLResource)resourceSet.createResource(XML_URI);
3
    if (options != null)
3
    if (options != null)
4
    {
4
    {
5
      Map<Object, Object> mergedOptions = new HashMap<Object, Object>(loadOptions);
5
      Map<Object, Object> mergedOptions = new HashMap<Object, Object>(loadOptions);
6
      mergedOptions.putAll(options);
6
      mergedOptions.putAll(options);
7
      resource.load(node, mergedOptions);
7
      resource.load(inputSource, mergedOptions);
8
    }
8
    }
9
    else
9
    else
10
    {
10
    {
11
      resource.load(node, loadOptions);
11
      resource.load(inputSource, loadOptions);
12
    }
12
    }
13
    resourceSet.getPackageRegistry().putAll(registry);
13
    resourceSet.getPackageRegistry().putAll(registry);
14
    return resource;
14
    return resource;
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.2
Clones locationClones are declared in the same class
Number of node comparisons35
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    ResourceSet resourceSet = createResourceSet();
    1
    ResourceSet resourceSet = createResourceSet();
    2
    XMLResource resource = (XMLResource)resourceSet.createResource(XML_URI);
    2
    XMLResource resource = (XMLResource)resourceSet.createResource(XML_URI);
    3
    if (options != null)
    3
    if (options != null)
    3
    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
    3
    if (options != null)
    4
    Map<Object, Object> mergedOptions = new HashMap<Object, Object>(loadOptions);
    4
    Map<Object, Object> mergedOptions = new HashMap<Object, Object>(loadOptions);
    5
    mergedOptions.putAll(options);
    5
    mergedOptions.putAll(options);
    5
    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
    5
    mergedOptions.putAll(options);
    6
    resource.load(node, mergedOptions);
    6
    resource.load(node, mergedOptions);
    6
    resource.load(inputSource, mergedOptions);
    Differences
    Expression1Expression2Difference
    nodeinputSourceVARIABLE_NAME_MISMATCH
    org.w3c.dom.Nodeorg.xml.sax.InputSourceVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.w3c.dom.Node of variable node does not match with type org.xml.sax.InputSource of variable inputSource
    • Make classes org.w3c.dom.Node and org.xml.sax.InputSource extend a common superclass
    6
    resource.load(inputSource, mergedOptions);
    else
    else
    7
    resource.load(node, loadOptions);
    7
    resource.load(node, loadOptions);
    7
    resource.load(inputSource, loadOptions);
    Differences
    Expression1Expression2Difference
    nodeinputSourceVARIABLE_NAME_MISMATCH
    org.w3c.dom.Nodeorg.xml.sax.InputSourceVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.w3c.dom.Node of variable node does not match with type org.xml.sax.InputSource of variable inputSource
    • Make classes org.w3c.dom.Node and org.xml.sax.InputSource extend a common superclass
    7
    resource.load(inputSource, loadOptions);
    8
    resourceSet.getPackageRegistry().putAll(registry);
    8
    resourceSet.getPackageRegistry().putAll(registry);
    9
    return resource;
    9
    return resource;
    Precondition Violations (4)
    Row Violation
    1Type java.util.Map<,> of variable options does not match with type java.util.Map<,> of variable options
    2Type java.util.Map<,> of variable options does not match with type java.util.Map<,> of variable options
    3Type org.w3c.dom.Node of variable node does not match with type org.xml.sax.InputSource of variable inputSource
    4Type org.w3c.dom.Node of variable node does not match with type org.xml.sax.InputSource of variable inputSource