JComponent bestReadyComponent = getBestReadyComponent(); if(null == bestReadyComponent) { return null; } return bestReadyComponent.getGraphics().getFont();
TabHandle selectedHandle = getSelectedHandle(); if(null == selectedHandle) { return null; } return selectedHandle.getWidget();
Clone fragments detected by clone detection tool
File path: /sql12/plugins/graph/src/net/sourceforge/squirrel_sql/plugins/graph/GraphTextAreaFactory.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/gui/desktopcontainer/docktabdesktop/DockTabDesktopPane.java
Method name: Font getFont() Method name: IWidget getSelectedWidget()
Number of AST nodes: 4 Number of AST nodes: 4
1
JComponent bestReadyComponent = getBestReadyComponent();
1
TabHandle selectedHandle = getSelectedHandle();
2
      if(null == bestReadyComponent)
2
      if(null == selectedHandle)
3
      {
3
      {
4
         return null;
4
         return null;
5
      }
5
      }
6
      return bestReadyComponent.getGraphics().getFont();
6
      return selectedHandle.getWidget();
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.1
Clones locationClones are in different classes
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                    
    1
    TabHandle selectedHandle = getSelectedHandle();
    1
    JComponent bestReadyComponent = getBestReadyComponent();
                                                                                                                      
    2
    if (null == bestReadyComponent)
    2
    if (null == bestReadyComponent)
    2
    if (null == selectedHandle)
    Differences
    Expression1Expression2Difference
    bestReadyComponentselectedHandleVARIABLE_NAME_MISMATCH
    javax.swing.JComponentnet.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.TabHandleVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type javax.swing.JComponent of variable bestReadyComponent does not match with type net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.TabHandle of variable selectedHandle
    • Make classes javax.swing.JComponent and net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.TabHandle extend a common superclass
    2
    if (null == selectedHandle)
    3
    return null;
    3
    return null;
                                                                              
    4
    return selectedHandle.getWidget();
    Preondition Violations
    Unmatched return selectedHandle.getWidget();
    4
    return selectedHandle.getWidget();
    4
    return bestReadyComponent.getGraphics().getFont();
    4
    return bestReadyComponent.getGraphics().getFont();
    Preondition Violations
    Unmatched return bestReadyComponent.getGraphics().getFont();
                                                                                                              
    Precondition Violations (4)
    Row Violation
    1Type javax.swing.JComponent of variable bestReadyComponent does not match with type net.sourceforge.squirrel_sql.client.gui.desktopcontainer.docktabdesktop.TabHandle of variable selectedHandle
    2Unmatched return selectedHandle.getWidget();
    3Unmatched return bestReadyComponent.getGraphics().getFont();
    4Not all possible execution flows end in a return statement