if (os != null) { try { os.close(); } catch (Exception e) { s_log.error("closeOutpuStream: Unable to close OutputStream - " + e.getMessage(), e); } }
try { conn.close(); } catch (SQLException ex) { // i18n[ConnectToAliasCommand.error.closeconnection=Error occured closing Connection] s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"), ex); }
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/mainframe/action/ConnectToAliasCommand.java
Method name: void closeOutputStream(OutputStream) Method name: void closeConnection(ISQLConnection)
Number of AST nodes: 3 Number of AST nodes: 2
1
if (os != null)
2
		{
3
			try
1
try
4
			{
2
				{
5
				os.close();
3
					conn.close();
6
			}
4
				}
7
			catch (Exception e)
5
				catch (SQLException ex)
8
			{
6
				{
9
				s_log.error("closeOutpuStream: Unable to close OutputStream - " + e.getMessage(
7
                    // i18n[ConnectToAliasCommand.error.closeconnection=Error occured closing Connection]
10
), e);
8
					s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"), ex);
11
			}
9
			
12
		}
10
	}
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 statements2
    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.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    try
    2
    try
    2
    try
    Differences
    Expression1Expression2Difference
    java.lang.Exceptionjava.sql.SQLExceptionSUBCLASS_TYPE_MISMATCH
    eexVARIABLE_NAME_MISMATCH
    java.lang.Exceptionjava.sql.SQLExceptionSUBCLASS_TYPE_MISMATCH
    "closeOutpuStream: Unable to close OutputStream - " + e.getMessage()s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection")TYPE_COMPATIBLE_REPLACEMENT
    eexVARIABLE_NAME_MISMATCH
    java.lang.Exceptionjava.sql.SQLExceptionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression "closeOutpuStream: Unable to close OutputStream - " + e.getMessage() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    try
    3
    os.close();
    3
    os.close();
    3
    conn.close();
    Differences
    Expression1Expression2Difference
    osconnVARIABLE_NAME_MISMATCH
    java.io.OutputStreamnet.sourceforge.squirrel_sql.fw.sql.ISQLConnectionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.OutputStream of variable os does not match with type net.sourceforge.squirrel_sql.fw.sql.ISQLConnection of variable conn
    • Make classes java.io.OutputStream and net.sourceforge.squirrel_sql.fw.sql.ISQLConnection extend a common superclass
    3
    conn.close();
    Precondition Violations (3)
    Row Violation
    1Expression "closeOutpuStream: Unable to close OutputStream - " + e.getMessage() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Type java.io.OutputStream of variable os does not match with type net.sourceforge.squirrel_sql.fw.sql.ISQLConnection of variable conn
    3The refactoring of the clones is infeasible, because classes net.sourceforge.squirrel_sql.fw.util.IOUtilitiesImpl and net.sourceforge.squirrel_sql.client.mainframe.action.ConnectToAliasCommand.SheetHandler do not have a common superclass