if (responseCode != null) {
try {
responseLevel = Integer.parseInt(responseCode) / 100;
} catch (NumberFormatException numberFormatException) {
// no need to change the foreground color
}
}
try {
FileServer.getFileServer().closeFile(FILENAME);
} catch (IOException e) {
// do nothing
}
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
|
|
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/util/accesslog/SharedTCLogParser.java
|
Method name: void valueChanged(TreeSelectionEvent)
|
|
Method name: void close()
|
Number of AST nodes: 3
|
|
Number of AST nodes: 2
|
|
1 | if (responseCode != null) {↵ | | |
|
2 | try {↵ | | 1 | try {↵
|
3 | responseLevel = Integer.parseInt(responseCode) / 100;↵ | | 2 | ↵
|
4 | } catch (NumberFormatException numberFormatException↵ | | 3 | FileServer.getFileServer().closeFile(FILENAME);↵
|
5 | ) {↵ | | 4 | } catch (IOException e) {↵
|
6 | // no need to change the foreground color↵ | | 5 | // ↵
|
7 | }↵ | | |
|
8 | ↵ | | 6 | do nothing↵
|
9 | } | | 7 | }
|
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 | 1 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 15.4 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
43 | try | | 1 | try |
| | | 2 | FileServer.getFileServer().closeFile(FILENAME); |
44 | responseLevel = Integer.parseInt(responseCode) / 100; | | | |
Precondition Violations (3)
Row |
Violation |
1 | Unmatched statement FileServer.getFileServer().closeFile(FILENAME); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
2 | Unmatched statement responseLevel=Integer.parseInt(responseCode) / 100; cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
3 | The refactoring of the clones is infeasible, because classes org.apache.jmeter.visualizers.ViewResultsFullVisualizer and org.apache.jmeter.protocol.http.util.accesslog.SharedTCLogParser do not have a common superclass |