try {
if (o == null) {
return defaultValue;
}
if (o instanceof Number) {
return ((Number) o).intValue();
}
return Integer.parseInt(o.toString());
} catch (NumberFormatException e) {
return defaultValue;
}
try {
if (o == null) {
return defaultValue;
}
if (o instanceof Number) {
return ((Number) o).longValue();
}
return Long.parseLong(o.toString());
} catch (NumberFormatException e) {
return defaultValue;
}
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jorphan/util/Converter.java
|
|
File path: /jakarta-jmeter-2.3.2/src/org/apache/jorphan/util/Converter.java
|
Method name: int getInt(Object, int)
|
|
Method name: long getLong(Object, long)
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | try {↵ | | 1 | try {↵
|
2 | if (o == null) {↵ | | 2 | if (o == null) {↵
|
3 | return defaultValue;↵ | | 3 | return defaultValue;↵
|
4 | }↵ | | 4 | }↵
|
5 | if (o instanceof Number) {↵ | | 5 | if (o instanceof Number) {↵
|
6 | return ((Number) o).intValue();↵ | | 6 | return ((Number) o).longValue();↵
|
7 | }↵ | | 7 | }↵
|
8 | return Integer.parseInt(o.toString());↵ | | 8 | return Long.parseLong(o.toString());↵
|
9 | } catch (NumberFormatException e) {↵ | | 9 | } catch (NumberFormatException e) {↵
|
10 | return defaultValue;↵ | | 10 | return defaultValue;↵
|
11 | } | | 11 | }
|
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 declared in the same class |
Number of node comparisons | 11 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 0.8 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
2 | if (o == null) | | 2 | if (o == null) |
| | | 3 | |
3 | | | | |
4 | if (o instanceof Number) | | 4 | if (o instanceof Number) |
| | | 5 | return ((Number)o).longValue(); |
5 | return ((Number)o).intValue(); | | | |
Precondition Violations (7)
Row |
Violation |
1 | Unmatched return defaultValue; |
2 | Unmatched return defaultValue; |
3 | Unmatched statement return ((Number)o).longValue(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
4 | Unmatched return ((Number)o).longValue(); |
5 | Unmatched statement return ((Number)o).intValue(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
6 | Unmatched return ((Number)o).intValue(); |
7 | The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero |