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); } }
for (CheckUpdateListener listener: _checkUpdateListeners) { try { listener.checkUpToDate(); } catch (Exception ex) { listener.showErrorMessage( "Unexpected Exception", "Update check failed with Exception: " + ex.getMessage(), ex); } }
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/mainframe/action/ConnectToAliasCommand.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/update/gui/UpdateManagerDialog.java
Method name: void closeConnection(ISQLConnection) Method name: void actionPerformed(ActionEvent)
Number of AST nodes: 3 Number of AST nodes: 3
1
if (conn != null)
2
			{
3
				try
4
				{
5
					conn.close();
6
				}
7
				
1
for (CheckUpdateListener listener: _checkUpdateListeners) {
2
               try {
3
                  listener.checkUpToDate();
8
catch (SQLException ex)
4
               } catch (Exception ex)
9
				{
5
 {
10
                    // i18n[ConnectToAliasCommand.error.closeconnection=Error occured closing Connection]
6
                  
11
					s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"), ex);
12
				}
13
			
7
listener.showErrorMessage(
8
                     "Unexpected Exception",
9
                     "Update check failed with Exception: " + ex.getMessage(),
10
                     ex);
11
               }
14
}
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.3
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)141.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    try
    2
    try
    3
    try
    Differences
    Expression1Expression2Difference
    java.sql.SQLExceptionjava.lang.ExceptionSUBCLASS_TYPE_MISMATCH
    java.sql.SQLExceptionjava.lang.ExceptionSUBCLASS_TYPE_MISMATCH
    errorshowErrorMessageMETHOD_INVOCATION_NAME_MISMATCH
    s_loglistenerVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.util.log.ILoggernet.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListenerVARIABLE_TYPE_MISMATCH
    s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"),ex)listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex)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 listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex) 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 listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex) is a void method call, and thus it cannot be parameterized
    Type net.sourceforge.squirrel_sql.fw.util.log.ILogger of variable s_log does not match with type net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener of variable listener
    • Make classes net.sourceforge.squirrel_sql.fw.util.log.ILogger and net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener 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 listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex) 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 listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex) is a void method call, and thus it cannot be parameterized
    3
    try
    3
    conn.close();
    3
    conn.close();
    4
    listener.checkUpToDate();
    Differences
    Expression1Expression2Difference
    closecheckUpToDateMETHOD_INVOCATION_NAME_MISMATCH
    connlistenerVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.sql.ISQLConnectionnet.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListenerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression conn.close() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression listener.checkUpToDate() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression conn.close() is a void method call, and thus it cannot be parameterized
    Expression listener.checkUpToDate() is a void method call, and thus it cannot be parameterized
    Type net.sourceforge.squirrel_sql.fw.sql.ISQLConnection of variable conn does not match with type net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener of variable listener
    • Make classes net.sourceforge.squirrel_sql.fw.sql.ISQLConnection and net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener extend a common superclass
    4
    listener.checkUpToDate();
    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 listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex) 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 listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex) is a void method call, and thus it cannot be parameterized
    5Type net.sourceforge.squirrel_sql.fw.util.log.ILogger of variable s_log does not match with type net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener of variable listener
    6Expression s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"),ex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"),ex) is a void method call, and thus it cannot be parameterized
    9Expression listener.showErrorMessage("Unexpected Exception","Update check failed with Exception: " + ex.getMessage(),ex) is a void method call, and thus it cannot be parameterized
    10Expression conn.close() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression listener.checkUpToDate() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression conn.close() is a void method call, and thus it cannot be parameterized
    13Expression listener.checkUpToDate() is a void method call, and thus it cannot be parameterized
    14Type net.sourceforge.squirrel_sql.fw.sql.ISQLConnection of variable conn does not match with type net.sourceforge.squirrel_sql.client.update.gui.CheckUpdateListener of variable listener
    15The refactoring of the clones is infeasible, because classes net.sourceforge.squirrel_sql.client.mainframe.action.ConnectToAliasCommand.SheetHandler and do not have a common superclass