File path: /emf-2.4.1/src/org/eclipse/emf/ecore/plugin/DynamicPackageRegistryReader.java | File path: /emf-2.4.1/src/org/eclipse/emf/ecore/plugin/ProtocolParserRegistryReader.java | |||
Method name: boolean readElement(IConfigurationElement, boolean)
|
Method name: boolean readElement(IConfigurationElement, boolean)
|
|||
Number of AST nodes: 15 | Number of AST nodes: 15 | |||
1 | if (element.getName().equals(TAG_RESOURCE))↵ | 1 | if (element.getName().equals(TAG_PARSER))↵ | |
2 | {↵ | 2 | {↵ | |
3 | String packageURI = element.getAttribute(ATT_URI);↵ | 3 | String protocolName = element.getAttribute(ATT_PROTOCOLNAME);↵ | |
4 | if (packageURI == null)↵ | 4 | if (protocolName == null)↵ | |
5 | {↵ | 5 | {↵ | |
6 | logMissingAttribute(element, ATT_URI);↵ | 6 | logMissingAttribute(element, ATT_PROTOCOLNAME);↵ | |
7 | }↵ | 7 | }↵ | |
8 | else if (element.getAttribute(ATT_LOCATION) == null)↵ | 8 | else if (element.getAttribute(ATT_CLASS) == null)↵ | |
9 | {↵ | 9 | {↵ | |
10 | logMissingAttribute(element, ATT_LOCATION);↵ | 10 | logMissingAttribute(element, ATT_CLASS);↵ | |
11 | }↵ | 11 | }↵ | |
12 | else if (add)↵ | 12 | else if (add)↵ | |
13 | {↵ | 13 | {↵ | |
14 | Object previous = EPackage.Registry.INSTANCE.put(packageURI, new EPackageDescriptor.Dynamic(element, ATT_LOCATION));↵ | 14 | Object previous = Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().put(protocolName, new ResourceFactoryDescriptor(element, ATT_CLASS));↵ | |
15 | if (previous instanceof PluginClassDescriptor)↵ | 15 | if (previous instanceof ResourceFactoryDescriptor)↵ | |
16 | {↵ | 16 | {↵ | |
17 | PluginClassDescriptor descriptor = (PluginClassDescriptor)previous;↵ | 17 | ResourceFactoryDescriptor descriptor = (ResourceFactoryDescriptor)previous;↵ | |
18 | EcorePlugin.INSTANCE.log↵ | 18 | EcorePlugin.INSTANCE.log↵ | |
19 | ("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register a package for '" + packageURI + "'");↵ | 19 | ("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register a protocol parser for '" + protocolName + "'");↵ | |
20 | }↵ | 20 | }↵ | |
21 | ↵ | |||
22 | return true;↵ | 21 | return true;↵ | |
23 | }↵ | 22 | }↵ | |
24 | else↵ | 23 | else↵ | |
25 | {↵ | 24 | {↵ | |
26 | EPackage.Registry.INSTANCE.remove(packageURI);↵ | 25 | Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().remove(protocolName);↵ | |
27 | return true;↵ | 26 | return true;↵ | |
28 | }↵ | 27 | }↵ | |
29 | }↵ | 28 | }↵ | |
30 | return false; | 29 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.7 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 52 |
Number of mapped statements | 13 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 5.4 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (element.getName().equals(TAG_RESOURCE)) |
| 1 | if (element.getName().equals(TAG_PARSER)) | ||||||||||||||||
2 | String packageURI = element.getAttribute(ATT_URI); |
| 2 | String protocolName = element.getAttribute(ATT_PROTOCOLNAME); | ||||||||||||||||
3 | if (packageURI == null) |
| 3 | if (protocolName == null) | ||||||||||||||||
4 | logMissingAttribute(element, ATT_URI); |
| 4 | logMissingAttribute(element, ATT_PROTOCOLNAME); | ||||||||||||||||
5 | else if (element.getAttribute(ATT_LOCATION) == null) |
| 5 | else if (element.getAttribute(ATT_CLASS) == null) | ||||||||||||||||
6 | logMissingAttribute(element, ATT_LOCATION); |
| 6 | logMissingAttribute(element, ATT_CLASS); | ||||||||||||||||
7 | else if (add) | 7 | else if (add) | |||||||||||||||||
|
| 8 | Object previous = Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().put(protocolName, new ResourceFactoryDescriptor(element, ATT_CLASS)); | |||||||||||||||||
8 | Object previous = EPackage.Registry.INSTANCE.put(packageURI, new EPackageDescriptor.Dynamic(element, ATT_LOCATION)); |
| | |||||||||||||||||
9 | if (previous instanceof PluginClassDescriptor) |
| 9 | if (previous instanceof ResourceFactoryDescriptor) | ||||||||||||||||
10 | PluginClassDescriptor descriptor = (PluginClassDescriptor)previous; |
| 10 | ResourceFactoryDescriptor descriptor = (ResourceFactoryDescriptor)previous; | ||||||||||||||||
11 | EcorePlugin.INSTANCE.log("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register a package for '" + packageURI + "'"); |
| 11 | EcorePlugin.INSTANCE.log("Both '" + descriptor.element.getContributor().getName() + "' and '" + element.getContributor().getName() + "' register a protocol parser for '" + protocolName + "'"); | ||||||||||||||||
12 | return true; | 12 | return true; | |||||||||||||||||
else | else | |||||||||||||||||||
| 13 | Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().remove(protocolName); | ||||||||||||||||||
13 | EPackage.Registry.INSTANCE.remove(packageURI); | | ||||||||||||||||||
14 | return true; | 14 | return true; | |||||||||||||||||
15 | return false; | 15 | return false; |
Row | Violation |
---|---|
1 | Unmatched statement Object previous=Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap().put(protocolName,new ResourceFactoryDescriptor(element,ATT_CLASS)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement Object previous=EPackage.Registry.INSTANCE.put(packageURI,new EPackageDescriptor.Dynamic(element,ATT_LOCATION)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |