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); } }
try { writer.close(); } catch (Exception e) { s_log.error("closeReader: Unable to close FileWriter - " + 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 closeWriter(Writer)
Number of AST nodes: 3 Number of AST nodes: 2
1
if (conn != null)
2
			{
3
				try
1
try
4
				{
2
			{
5
					conn.close();
3
				writer.close();
6
				}
4
			}
7
				catch (SQLException ex)
5
			catch (Exception e)
8
				{
6
			{
9
                    // i18n[ConnectToAliasCommand.error.closeconnection=Error occured closing Connection]
7
				s_log.error("close
10
					s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"), ex);
8
Reader: Unable to close FileWriter - " + e.getMessage(), e);
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)4.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    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")"closeReader: Unable to close FileWriter - " + e.getMessage()TYPE_COMPATIBLE_REPLACEMENT
    exeVARIABLE_NAME_MISMATCH
    java.sql.SQLExceptionjava.lang.ExceptionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression "closeReader: Unable to close FileWriter - " + 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
    writer.close();
    Differences
    Expression1Expression2Difference
    connwriterVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.sql.ISQLConnectionjava.io.WriterVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type net.sourceforge.squirrel_sql.fw.sql.ISQLConnection of variable conn does not match with type java.io.Writer of variable writer
    • Make classes net.sourceforge.squirrel_sql.fw.sql.ISQLConnection and java.io.Writer extend a common superclass
    3
    writer.close();
    Precondition Violations (3)
    Row Violation
    1Expression "closeReader: Unable to close FileWriter - " + e.getMessage() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Type net.sourceforge.squirrel_sql.fw.sql.ISQLConnection of variable conn does not match with type java.io.Writer of variable writer
    3The 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