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
          }
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.2
Clones locationClones are in different classes
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    11
    try
    10
    try
    12
    result = colorDescriptor.createColor(display);
    12
    result = colorDescriptor.createColor(display);
    11
    result = fontDescriptor.createFont(display);
    Differences
    Expression1Expression2Difference
    org.eclipse.swt.graphics.Colororg.eclipse.swt.graphics.FontSUBCLASS_TYPE_MISMATCH
    createColorcreateFontMETHOD_INVOCATION_NAME_MISMATCH
    colorDescriptorfontDescriptorVARIABLE_NAME_MISMATCH
    org.eclipse.jface.resource.ColorDescriptororg.eclipse.jface.resource.FontDescriptorSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression colorDescriptor.createColor(display) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression fontDescriptor.createFont(display) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    11
    result = fontDescriptor.createFont(display);
    Precondition Violations (3)
    Row Violation
    1Expression colorDescriptor.createColor(display) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    2Expression fontDescriptor.createFont(display) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    3Clone 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