for (int i = 0; i < delegateResourceLocators.length; ++i)
{
try
{
return delegateResourceLocators[i].getString(key, translate);
}
catch (MissingResourceException exception)
{
// Ignore this since we will throw an exception when all else fails.
}
}
try
{
return (Comparator<String>)COLLATOR_GET_INSTANCE_METHOD.invoke(null, locale);
}
catch (Throwable eception)
{
// Just return the default.
}
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/common/util/DelegatingResourceLocator.java
|
|
File path: /emf-2.4.1/src/org/eclipse/emf/common/CommonPlugin.java
|
Method name: String delegatedGetString(String, boolean)
|
|
Method name: Comparator getComparator(Locale)
|
Number of AST nodes: 3
|
|
Number of AST nodes: 2
|
|
1 | for (int i = 0; i < delegateResourceLocators.length; ++i)↵ | | |
|
2 | {↵ | | |
|
3 | try↵ | | |
|
4 | {↵ | | |
|
5 | return delegateResourceLocators[i].getString(key, translat↵ | | 1 | try↵
|
| | | 2 | {↵
|
6 | e);↵ | | 3 | return (Comparator<String>)COLLATOR_GET_INSTANCE_METHOD.invoke(null, locale);↵
|
7 | }↵ | | 4 | }↵
|
8 | catch (MissingResourceException exception)↵ | | 5 | catch (Throwable eception)↵
|
9 | {↵ | | 6 | {↵
|
10 | // Ignore this since we will throw an exception when all else fails.↵ | | 7 | // Just return the default.↵
|
11 | }↵ | | 8 | }
|
12 | } | | | |
See real code fragment |
|
See real code fragment |
Summary
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.1 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 5 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.4 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
3 | try | | 2 | try |
| | | 3 | return (Comparator<String>)COLLATOR_GET_INSTANCE_METHOD.invoke(null, locale); |
4 | return delegateResourceLocators[i].getString(key, translate); | | | |
Precondition Violations (3)
Row |
Violation |
1 | Unmatched statement return (Comparator<String>)COLLATOR_GET_INSTANCE_METHOD.invoke(null,locale); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
2 | Unmatched return (Comparator<String>)COLLATOR_GET_INSTANCE_METHOD.invoke(null,locale); |
3 | Unmatched return delegateResourceLocators[i].getString(key,translate); |