if (_conn != null) { try { _conn.close(); } finally { _conn = null; } }
if (_session != null) { try { getCommand().execute(); } catch (Exception e) { _session.showMessage(e); } }
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/Session.java File path: /sql12/plugins/postgres/src/net/sourceforge/squirrel_sql/plugins/postgres/actions/AbstractSessionAction.java
Method name: void closeSQLConnection() Method name: void actionPerformed(ActionEvent)
Number of AST nodes: 3 Number of AST nodes: 3
1
if (_conn != null)
1
if (_session != null) {
2
      {
2
   
3
         try
3
         try
4
         {
4
 {
5
            _conn.close();
5
                getCommand().execute();
6
         }
6
         
7
         finally
7
   
8
     
8
} catch (Exception e) {
9
    {
9
    
10
            _conn = null;
10
            _
11
session.showMessage(e);
11
         }
12
            }
12
      }
13
        }
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.0
Clones locationClones are in different classes
Number of node comparisons2
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    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.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (_conn != null)
    1
    if (_conn != null)
    1
    if (_session != null)
    Differences
    Expression1Expression2Difference
    _conn_sessionVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.sql.SQLConnectionnet.sourceforge.squirrel_sql.client.session.ISessionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type net.sourceforge.squirrel_sql.fw.sql.SQLConnection of variable _conn does not match with type net.sourceforge.squirrel_sql.client.session.ISession of variable _session
    • Make classes net.sourceforge.squirrel_sql.fw.sql.SQLConnection and net.sourceforge.squirrel_sql.client.session.ISession extend a common superclass
    1
    if (_session != null)
                
    2
    try
                                                        
    3
    getCommand().execute();
    Preondition Violations
    Unmatched statement getCommand().execute(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement getCommand().execute(); 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
    3
    getCommand().execute();
    2
    try
                
    3
    _conn.close();
    3
    _conn.close();
    Preondition Violations
    Unmatched statement _conn.close(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement _conn.close(); 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
                                      
    Precondition Violations (6)
    Row Violation
    1Type net.sourceforge.squirrel_sql.fw.sql.SQLConnection of variable _conn does not match with type net.sourceforge.squirrel_sql.client.session.ISession of variable _session
    2Unmatched statement getCommand().execute(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement getCommand().execute(); 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
    4Unmatched statement _conn.close(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement _conn.close(); 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
    6The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero