if (conn != null) { try { conn.close(); } catch (SQLException ex) { // i18n[ConnectToAliasCommand.error.closeconnection=Error occured closing Connection] s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"), ex); } }
if (is != null) { try { is.close(); } catch (Exception e) { s_log.error("closeInputStream: Unable to close InputStream - " + e.getMessage(), e); } }
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/mainframe/action/ConnectToAliasCommand.java File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/util/IOUtilitiesImpl.java
Method name: void closeConnection(ISQLConnection) Method name: void closeInputStream(InputStream)
Number of AST nodes: 3 Number of AST nodes: 3
1
if (conn != null)
1
if (is != null)
2
			{
2
		{
3
				try
3
			try
4
				{
4
			{
5
					conn.close();
5
				is.close();
6
				}
6
			}
7
				catch (SQLException ex)
7
			catch (Exception e)
8
				{
8
			{
9
                    // i18n[ConnectToAliasCommand.error.closeconnection=Error occured closing Connection]
9
				s_log.error("close
10
					s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"), ex);
10
InputStream: Unable to close InputStream - " + e.getMessage(), e);
11
				}
11
			}
12
			}
12
		}
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.4
Clones locationClones are in different classes
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)5.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (conn != null)
    1
    if (conn != null)
    1
    if (is != null)
    Differences
    Expression1Expression2Difference
    connisVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.sql.ISQLConnectionjava.io.InputStreamVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type net.sourceforge.squirrel_sql.fw.sql.ISQLConnection of variable conn does not match with type java.io.InputStream of variable is
    • Make classes net.sourceforge.squirrel_sql.fw.sql.ISQLConnection and java.io.InputStream extend a common superclass
    1
    if (is != null)
    2
    try
    2
    try
    2
    try
    Differences
    Expression1Expression2Difference
    java.sql.SQLExceptionjava.lang.ExceptionSUBCLASS_TYPE_MISMATCH
    exeVARIABLE_NAME_MISMATCH
    java.sql.SQLExceptionjava.lang.ExceptionSUBCLASS_TYPE_MISMATCH
    s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection")"closeInputStream: Unable to close InputStream - " + e.getMessage()TYPE_COMPATIBLE_REPLACEMENT
    exeVARIABLE_NAME_MISMATCH
    java.sql.SQLExceptionjava.lang.ExceptionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression "closeInputStream: Unable to close InputStream - " + e.getMessage() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    try
    3
    conn.close();
    3
    conn.close();
    3
    is.close();
    Differences
    Expression1Expression2Difference
    connisVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.sql.ISQLConnectionjava.io.InputStreamVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type net.sourceforge.squirrel_sql.fw.sql.ISQLConnection of variable conn does not match with type java.io.InputStream of variable is
    • Make classes net.sourceforge.squirrel_sql.fw.sql.ISQLConnection and java.io.InputStream extend a common superclass
    3
    is.close();
    Precondition Violations (4)
    Row Violation
    1Type net.sourceforge.squirrel_sql.fw.sql.ISQLConnection of variable conn does not match with type java.io.InputStream of variable is
    2Expression "closeInputStream: Unable to close InputStream - " + e.getMessage() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type net.sourceforge.squirrel_sql.fw.sql.ISQLConnection of variable conn does not match with type java.io.InputStream of variable is
    4The refactoring of the clones is infeasible, because classes net.sourceforge.squirrel_sql.client.mainframe.action.ConnectToAliasCommand.SheetHandler and net.sourceforge.squirrel_sql.fw.util.IOUtilitiesImpl do not have a common superclass