if (is != null) { try { is.close(); } catch (Exception e) { s_log.error("closeInputStream: Unable to close InputStream - " + e.getMessage(), e); } }
if (_conn != null) { try { _conn.close(); } finally { _conn = null; } }
Clone fragments detected by clone detection tool
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/util/IOUtilitiesImpl.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/Session.java
Method name: void closeInputStream(InputStream) Method name: void closeSQLConnection()
Number of AST nodes: 3 Number of AST nodes: 3
1
if (is != null)
1
if (_conn != null)
2
		{
3
			try
4
			{
5
				is.close();
6
			}
7
			catch (Exception e)
8
			{
9
				s_log.error("closeInputStream: Unable to close InputStream - " + e.getMessage(), e);
10
			}
11
		
2
      {
3
         try
4
         {
5
            _conn.close();
6
         }
7
         finally
8
         {
9
            _conn = null;
10
         }
12
}
11
      }
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.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (is != null)
    1
    if (is != null)
    1
    if (_conn != null)
    Differences
    Expression1Expression2Difference
    is_connVARIABLE_NAME_MISMATCH
    java.io.InputStreamnet.sourceforge.squirrel_sql.fw.sql.SQLConnectionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.InputStream of variable is does not match with type net.sourceforge.squirrel_sql.fw.sql.SQLConnection of variable _conn
    • Make classes java.io.InputStream and net.sourceforge.squirrel_sql.fw.sql.SQLConnection extend a common superclass
    1
    if (_conn != null)
                
    2
    try
                                      
    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
    3
    _conn.close();
    2
    try
                
    3
    is.close();
    3
    is.close();
    Preondition Violations
    Unmatched statement is.close(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement is.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 java.io.InputStream of variable is does not match with type net.sourceforge.squirrel_sql.fw.sql.SQLConnection of variable _conn
    2Unmatched statement _conn.close(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched 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
    4Unmatched statement is.close(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement is.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