if (type == null) { logMissingAttribute(element, ATT_TYPE); } else if (element.getAttribute(ATT_CLASS) == null) { logMissingAttribute(element, ATT_CLASS); } else if (add) { Object previous = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(type, new ResourceFactoryDescriptor(element, ATT_CLASS)); if (previous instanceof ResourceFactoryDescriptor) { ResourceFactoryDescriptor descriptor = (ResourceFactoryDescriptor)previous; EcorePlugin.INSTANCE.log ("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register an extension parser for '" + type + "'"); } return true; } else { Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().remove(type); return true;
if (protocolName == null) { logMissingAttribute(element, ATT_PROTOCOLNAME); } else if (element.getAttribute(ATT_CLASS) == null) { logMissingAttribute(element, ATT_CLASS); } else if (add) { Object previous = Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().put(protocolName, new ResourceFactoryDescriptor(element, ATT_CLASS)); if (previous instanceof ResourceFactoryDescriptor) { ResourceFactoryDescriptor descriptor = (ResourceFactoryDescriptor)previous; EcorePlugin.INSTANCE.log ("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register a protocol parser for '" + protocolName + "'"); } return true; } else { Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().remove(protocolName); return true;
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/plugin/ExtensionParserRegistryReader.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/plugin/ProtocolParserRegistryReader.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
if (type == null)
1
if (protocolName == null)
2
      {
2
      {
3
        logMissingAttribute(element, ATT_TYPE);
3
        logMissingAttribute(element, ATT_PROTOCOLNAME);
4
      }
4
      }
5
      else if (element.getAttribute(ATT_CLASS) == null)
5
      else if (element.getAttribute(ATT_CLASS) == null)
6
      {
6
      {
7
        logMissingAttribute(element, ATT_CLASS);
7
        logMissingAttribute(element, ATT_CLASS);
8
      }
8
      }
9
      else if (add)
9
      else if (add)
10
      {
10
      {
11
        Object previous = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(type, new ResourceFactoryDescriptor(element, ATT_CLASS));
11
        Object previous = Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().put(protocolName, new ResourceFactoryDescriptor(element, ATT_CLASS));
12
        if (previous instanceof ResourceFactoryDescriptor)
12
        if (previous instanceof ResourceFactoryDescriptor)
13
        {
13
        {
14
          ResourceFactoryDescriptor descriptor = (ResourceFactoryDescriptor)previous;
14
          ResourceFactoryDescriptor descriptor = (ResourceFactoryDescriptor)previous;
15
          EcorePlugin.INSTANCE.log
15
          EcorePlugin.INSTANCE.log
16
            ("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register an extension parser for '" + type + "'");
16
            ("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register a protocol parser for '" + protocolName + "'");
17
        }
17
        }
18
        return true;
18
        return true;
19
      }
19
      }
20
      else
20
      else
21
      {
21
      {
22
        Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().remove(type);
22
        Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().remove(protocolName);
23
        return true;
23
        return true;
24
      
24
      
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0