XMLResource.XMLInfo info = xmlMap.getInfo(eStructuralFeature); if (info != null) { String name = info.getName(); if (name != null) { return info.getName(); } } return super.getName(eStructuralFeature);
Node node = attributes.item(index); if (node != null) { String prefix = node.getPrefix(); if (ExtendedMetaData.XMLNS_PREFIX.equals(prefix)) { return ""; } return node.getLocalName(); } return null;
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/EMOFExtendedMetaData.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLLoadImpl.java
Method name: String getName(EStructuralFeature) Method name: String getLocalName(int)
Number of AST nodes: 6 Number of AST nodes: 7
1
XMLResource.XMLInfo info = xmlMap.getInfo(eStructuralFeature);
1
Node node = attributes.item(index);
2
    if (info != null)
2
      if (node != null)
3
    {
3
      {
4
      String name = info.getName();
4
        String prefix = node.getPrefix();
5
      if (name != null)
5
        if (
6
ExtendedMetaData.XMLNS_PREFIX.equals(prefix))
6
      {
7
        {
7
        return info.getName();
8
          return "";
8
      }
9
        }
9
    }
10
    
10
    return super.getName(eStructuralFeature)
11
    return node.getLocalName();
12
      }
11
;
13
      return null;
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 comparisons11
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)1.9
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                            
    1
    Node node = attributes.item(index);
    1
    XMLResource.XMLInfo info = xmlMap.getInfo(eStructuralFeature);
                                                                                                                                  
    2
    if (info != null)
    2
    if (info != null)
    2
    if (node != null)
    Differences
    Expression1Expression2Difference
    infonodeVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.xmi.XMLResource.XMLInfoorg.w3c.dom.NodeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.xmi.XMLResource.XMLInfo of variable info does not match with type org.w3c.dom.Node of variable node
    • Make classes org.eclipse.emf.ecore.xmi.XMLResource.XMLInfo and org.w3c.dom.Node extend a common superclass
    2
    if (node != null)
                                                                        
    3
    String prefix = node.getPrefix();
    Preondition Violations
    Unmatched statement String prefix=node.getPrefix(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    String prefix = node.getPrefix();
    3
    String name = info.getName();
    3
    String name = info.getName();
    Preondition Violations
    Unmatched statement String name=info.getName(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                
                                                                                                          
    4
    if (ExtendedMetaData.XMLNS_PREFIX.equals(prefix))
                              
    5
    return "";
    Preondition Violations
    Unmatched return "";
    5
    return "";
    4
    if (name != null)
                                          
    5
    return info.getName();
    5
    return info.getName();
    Preondition Violations
    Unmatched statement return info.getName(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return info.getName();
                                                      
                                                                
    6
    return node.getLocalName();
    Preondition Violations
    Unmatched statement return node.getLocalName(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return node.getLocalName();
    6
    return node.getLocalName();
    6
    return super.getName(eStructuralFeature);
    6
    return super.getName(eStructuralFeature);
    7
    return null;
    Differences
    Expression1Expression2Difference
    super.getName(eStructuralFeature)nullTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Super method call return super.getName(eStructuralFeature); cannot be extracted from method
    7
    return null;
    Precondition Violations (10)
    Row Violation
    1Type org.eclipse.emf.ecore.xmi.XMLResource.XMLInfo of variable info does not match with type org.w3c.dom.Node of variable node
    2Unmatched statement String prefix=node.getPrefix(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement String name=info.getName(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched return "";
    5Unmatched statement return info.getName(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched return info.getName();
    7Unmatched statement return node.getLocalName(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8Unmatched return node.getLocalName();
    9Super method call return super.getName(eStructuralFeature); cannot be extracted from method
    10The refactoring of the clones is infeasible, because classes org.eclipse.emf.ecore.xmi.impl.EMOFExtendedMetaData and org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.AttributesProxy do not have a common superclass