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 { con.commit(); } catch (Exception e) { e.printStackTrace(); }
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/mainframe/action/ConnectToAliasCommand.java File path: /sql12/test/mockobjects/net/sourceforge/squirrel_sql/client/session/MockSession.java
Method name: void closeConnection(ISQLConnection) Method name: void commit()
Number of AST nodes: 3 Number of AST nodes: 2
1
if (conn != null)
2
			{
3
				try
4
				{
5
					
1
try {
6
conn.close();
2
            con.c
7
				}
8
				
3
ommit();
9
catch (SQLException ex)
4
        } catch (Exception e
10
				{
11
  
5
) {
12
                  // i18n[ConnectToAliasCommand.error.closeconnection=Error occured closing Connection]
6
            
13
					s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"), ex);
14
				}
15
			
7
e.printStackTrace();
16
}
8
        }
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.3
Clones locationClones are in different classes
Number of node comparisons4
  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)26.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    try
    2
    try
    1
    try
    Differences
    Expression1Expression2Difference
    java.sql.SQLExceptionjava.lang.ExceptionSUBCLASS_TYPE_MISMATCH
    exeVARIABLE_NAME_MISMATCH
    java.sql.SQLExceptionjava.lang.ExceptionSUBCLASS_TYPE_MISMATCH
    errorprintStackTraceMETHOD_INVOCATION_NAME_MISMATCH
    s_logeVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.util.log.ILoggerjava.lang.ExceptionVARIABLE_TYPE_MISMATCH
    s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"),ex)e.printStackTrace()ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"),ex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"),ex) is a void method call, and thus it cannot be parameterized
    Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized
    Expression e cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type net.sourceforge.squirrel_sql.fw.util.log.ILogger of variable s_log does not match with type java.lang.Exception of variable e
    • Make classes net.sourceforge.squirrel_sql.fw.util.log.ILogger and java.lang.Exception extend a common superclass
    Expression s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"),ex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"),ex) is a void method call, and thus it cannot be parameterized
    Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized
    1
    try
    3
    conn.close();
    3
    conn.close();
    2
    con.commit();
    Differences
    Expression1Expression2Difference
    closecommitMETHOD_INVOCATION_NAME_MISMATCH
    connconVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.sql.ISQLConnectionnet.sourceforge.squirrel_sql.fw.sql.SQLConnectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression conn.close() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression con.commit() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression conn.close() is a void method call, and thus it cannot be parameterized
    Expression con.commit() is a void method call, and thus it cannot be parameterized
    2
    con.commit();
    Precondition Violations (15)
    Row Violation
    1Expression s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"),ex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"),ex) is a void method call, and thus it cannot be parameterized
    4Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized
    5Expression e cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type net.sourceforge.squirrel_sql.fw.util.log.ILogger of variable s_log does not match with type java.lang.Exception of variable e
    7Expression s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"),ex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"),ex) is a void method call, and thus it cannot be parameterized
    10Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized
    11Expression conn.close() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression con.commit() is a method call throwing exception(s) that should be caught by a try block that will be extracted
    13Expression conn.close() is a void method call, and thus it cannot be parameterized
    14Expression con.commit() is a void method call, and thus it cannot be parameterized
    15The refactoring of the clones is infeasible, because classes net.sourceforge.squirrel_sql.client.mainframe.action.ConnectToAliasCommand.SheetHandler and net.sourceforge.squirrel_sql.client.session.MockSession do not have a common superclass