if (wssp != null) { WebServiceSession wss = wssp.getWebServiceSession(); if (wss != null) { wss.close(); } }
if (session != null) { SessionPanel sessionPanel = session.getSessionSheet(); if (sessionPanel != null) { result = sessionPanel.isObjectTreeTabSelected(); } }
Clone fragments detected by clone detection tool
File path: /sql12/plugins/sqlval/src/net/sourceforge/squirrel_sql/plugins/sqlval/SQLValidatorPlugin.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/objecttree/tabs/table/ContentsTab.java
Method name: void sessionEnding(ISession) Method name: boolean objectTreeTabIsSelected()
Number of AST nodes: 4 Number of AST nodes: 4
1
if (wssp != null) {
1
if (session != null) {
2
            WebServiceSession wss = wssp.getWebServiceSession();
2
         SessionPanel sessionPanel = session.getSessionSheet();
3
            if (wss != null) {
3
         if (sessionPanel != null) {
4
                wss.close();
4
            result = sessionPanel.isObjectTreeTabSelected();
5
            }
5
         
6
  
6
}
7
      }
7
      }
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 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)1.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    if (wssp != null)
    3
    if (wssp != null)
    3
    if (session != null)
    Differences
    Expression1Expression2Difference
    wsspsessionVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.plugins.sqlval.WebServiceSessionPropertiesnet.sourceforge.squirrel_sql.client.session.ISessionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type net.sourceforge.squirrel_sql.plugins.sqlval.WebServiceSessionProperties of variable wssp does not match with type net.sourceforge.squirrel_sql.client.session.ISession of variable session
    • Make classes net.sourceforge.squirrel_sql.plugins.sqlval.WebServiceSessionProperties and net.sourceforge.squirrel_sql.client.session.ISession extend a common superclass
    3
    if (session != null)
                                                                                                                  
    4
    SessionPanel sessionPanel = session.getSessionSheet();
    Preondition Violations
    Unmatched statement SessionPanel sessionPanel=session.getSessionSheet(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4
    SessionPanel sessionPanel = session.getSessionSheet();
    4
    WebServiceSession wss = wssp.getWebServiceSession();
    4
    WebServiceSession wss = wssp.getWebServiceSession();
    Preondition Violations
    Unmatched statement WebServiceSession wss=wssp.getWebServiceSession(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                              
    5
    if (wss != null)
    5
    if (wss != null)
    5
    if (sessionPanel != null)
    Differences
    Expression1Expression2Difference
    wsssessionPanelVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.plugins.sqlval.WebServiceSessionnet.sourceforge.squirrel_sql.client.gui.session.SessionPanelVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type net.sourceforge.squirrel_sql.plugins.sqlval.WebServiceSession of variable wss does not match with type net.sourceforge.squirrel_sql.client.gui.session.SessionPanel of variable sessionPanel
    • Make classes net.sourceforge.squirrel_sql.plugins.sqlval.WebServiceSession and net.sourceforge.squirrel_sql.client.gui.session.SessionPanel extend a common superclass
    5
    if (sessionPanel != null)
                                                                                                      
    6
    result = sessionPanel.isObjectTreeTabSelected();
    Preondition Violations
    Unmatched statement result=sessionPanel.isObjectTreeTabSelected(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6
    result = sessionPanel.isObjectTreeTabSelected();
    6
    wss.close();
    6
    wss.close();
    Preondition Violations
    Unmatched statement wss.close(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                  
    Precondition Violations (7)
    Row Violation
    1Type net.sourceforge.squirrel_sql.plugins.sqlval.WebServiceSessionProperties of variable wssp does not match with type net.sourceforge.squirrel_sql.client.session.ISession of variable session
    2Unmatched statement SessionPanel sessionPanel=session.getSessionSheet(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement WebServiceSession wss=wssp.getWebServiceSession(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Type net.sourceforge.squirrel_sql.plugins.sqlval.WebServiceSession of variable wss does not match with type net.sourceforge.squirrel_sql.client.gui.session.SessionPanel of variable sessionPanel
    5Unmatched statement result=sessionPanel.isObjectTreeTabSelected(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched statement wss.close(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7The refactoring of the clones is infeasible, because classes net.sourceforge.squirrel_sql.plugins.sqlval.SQLValidatorPlugin and net.sourceforge.squirrel_sql.client.session.mainpanel.objecttree.tabs.table.ContentsTab do not have a common superclass