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: 2
|
|
Number of AST nodes: 2
|
|
1 | try↵ | | 1 | try↵
|
2 | {↵ | | 2 | {↵
|
3 | os.close();↵ | | 3 | conn.close();↵
|
4 | }↵ | | 4 | }↵
|
5 | catch (Exception e)↵ | | 5 | catch (SQLException ex)↵
|
6 | {↵ | | 6 | {↵
|
7 | s_log.error("closeOutpuStream: Unable to close OutputStream - " + e.getMessage(↵ | | 7 | // i18n[ConnectToAliasCommand.error.closeconnection=Error occured closing Connection]↵
|
8 | ), e);↵ | | 8 | s_log.error(s_stringMgr.getString("ConnectToAliasCommand.error.closeconnection"), ex);↵
|
9 | } | | 9 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3 |
Clones location | Clones are in different classes |
Number of node comparisons | 5 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 4.5 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
2 | try | | 2 | try |
3 | | | 3 | |
Precondition Violations (3)
Row |
Violation |
1 | Expression "closeOutpuStream: Unable to close OutputStream - " + e.getMessage() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Type java.io.OutputStream of variable os does not match with type net.sourceforge.squirrel_sql.fw.sql.ISQLConnection of variable conn |
3 | The 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 |