try
{
result = colorDescriptor.createColor(display);
}
catch (DeviceResourceException exception)
{
EMFEditUIPlugin.INSTANCE.log(exception);
}
try
{
result = fontDescriptor.createFont(display);
}
catch (DeviceResourceException exception)
{
EMFEditUIPlugin.INSTANCE.log(exception);
}
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/edit/ui/provider/ExtendedColorRegistry.java
|
|
File path: /emf-2.4.1/src/org/eclipse/emf/edit/ui/provider/ExtendedFontRegistry.java
|
Method name: Color getColor(Color, Color, Object)
|
|
Method name: Font getFont(Font, Object)
|
Number of AST nodes: 2
|
|
Number of AST nodes: 2
|
|
1 | try↵ | | 1 | try↵
|
2 | {↵ | | 2 | {↵
|
3 | result = colorDescriptor.createColor(display);↵ | | 3 | result = fontDescriptor.createFont(display);↵
|
4 | }↵ | | 4 | }↵
|
5 | catch (DeviceResourceException exception)↵ | | 5 | catch (DeviceResourceException exception)↵
|
6 | {↵ | | 6 | {↵
|
7 | EMFEditUIPlugin.INSTANCE.log(exception);↵ | | 7 | EMFEditUIPlugin.INSTANCE.log(exception);↵
|
8 | } | | 8 | }
|
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.2 |
Clones location | Clones are in different classes |
Number of node comparisons | 5 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.6 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
11 | try | | 10 | try |
12 | result = colorDescriptor.createColor(display); | | 11 | result = fontDescriptor.createFont(display); |
Precondition Violations (3)
Row |
Violation |
1 | Expression colorDescriptor.createColor(display) is a method call throwing exception(s) that should be caught by a try block that will be extracted |
2 | Expression fontDescriptor.createFont(display) is a method call throwing exception(s) that should be caught by a try block that will be extracted |
3 | Clone fragment #1 returns variable result with type org.eclipse.swt.graphics.Color , while Clone fragment #2 returns variable result with type org.eclipse.swt.graphics.Font |