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
{
is.close();
}
catch (Exception e)
{
s_log.error("closeInputStream: Unable to close InputStream - " + 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 closeInputStream(InputStream)
|
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 | is.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 | InputStream: Unable to close InputStream - " + e.getMessage(), e);↵
|
11 | }↵ | | 9 | ↵
|
12 | } | | 10 | }
|
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.4 |
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 "closeInputStream: Unable to close InputStream - " + e.getMessage() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Type net.sourceforge.squirrel_sql.fw.sql.ISQLConnection of variable conn does not match with type java.io.InputStream of variable is |
3 | The 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 |