try {
message = formatter.format(th);
} catch (Exception e) {
s_log.error("Unable to format message: "+e.getMessage(), e);
}
if (customFormatter != null && customFormatter.formatsException(cause)) {
try {
customMessage = customFormatter.format(cause);
} catch (Exception e) {
s_log.error(
"Exception occurred while formatting: "+e.getMessage(), e);
}
}
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/MessagePanel.java
|
|
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/util/DefaultExceptionFormatter.java
|
Method name: void privateShowMessage(Throwable, ExceptionFormatter, SimpleAttributeSet)
|
|
Method name: String format(Throwable)
|
Number of AST nodes: 2
|
|
Number of AST nodes: 3
|
|
1 | try {↵ | | |
|
2 | m↵ | | 1 | if (customFormatter != null && customFormatter.formatsException(cause)) {↵
|
| | | 2 | try {↵
|
3 | essage = formatter.format(th);↵ | | 3 | customMessage = customFormatter.format(cause);↵
|
4 | } catch (Exception e) {↵ | | 4 | } catch (Exception e) {↵
|
5 | s_log.error("Unable to format message:↵ | | 5 | s_log.error( ↵
|
6 | "+e.getMessage(), e);↵ | | 6 | "Exception occurred while formatting: "+e.getMessage(), e);↵
|
7 | ↵ | | 7 | }↵
|
8 | } | | 8 | }
|
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.2 |
Clones location | Clones are in different classes |
Number of node comparisons | 4 |
-
{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) | 1.1 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
5 | try | | 11 | try |
6 | message = formatter.format(th); | | 12 | customMessage = customFormatter.format(cause); |
Precondition Violations (1)
Row |
Violation |
1 | The refactoring of the clones is infeasible, because classes net.sourceforge.squirrel_sql.client.session.MessagePanel and net.sourceforge.squirrel_sql.fw.util.DefaultExceptionFormatter do not have a common superclass |