if (params == null || !params.containsKey(name)) {
return defaultValue;
}
try {
return Long.decode((String) params.get(name)).longValue();
} catch (NumberFormatException e) {
log.warn("Value for parameter '" + name + "' not a long: '" + params.get(name) + "'. Using default: '"
+ defaultValue + "'.", e);
return defaultValue;
}
if (params == null || !params.containsKey(name)) {
return defaultValue;
}
try {
return Integer.decode((String) params.get(name)).intValue();
} catch (NumberFormatException e) {
log.warn("Value for parameter '" + name + "' not an integer: '" + params.get(name) + "'. Using default: '"
+ defaultValue + "'.", e);
return defaultValue;
}
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/java/sampler/JavaSamplerContext.java
|
|
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/java/sampler/JavaSamplerContext.java
|
Method name: long getLongParameter(String, long)
|
|
Method name: int getIntParameter(String, int)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | if (params == null || !params.containsKey(name)) {↵ | | 1 | if (params == null || !params.containsKey(name)) {↵
|
2 | return defaultValue;↵ | | 2 | return defaultValue;↵
|
3 | }↵ | | 3 | }↵
|
|
4 | try {↵ | | 4 | try {↵
|
5 | return Long.decode((String) params.get(name)).longValue();↵ | | 5 | return Integer.decode((String) params.get(name)).intValue();↵
|
6 | } catch (NumberFormatException e) {↵ | | 6 | } catch (NumberFormatException e) {↵
|
7 | log.warn("Value for parameter '" + name + "' not a long: '" + params.get(name) + "'. Using default: '"↵ | | 7 | log.warn("Value for parameter '" + name + "' not an integer: '" + params.get(name) + "'. Using default: '"↵
|
8 | + defaultValue + "'.", e);↵ | | 8 | + defaultValue + "'.", e);↵
|
9 | return defaultValue;↵ | | 9 | return defaultValue;↵
|
10 | } | | 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.6 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 7 |
-
{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) | 0.8 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | if (params == null || !params.containsKey(name)) | | 1 | if (params == null || !params.containsKey(name)) |
| | | 2 | |
2 | | | | |
Precondition Violations (3)
Row |
Violation |
1 | Unmatched return defaultValue; |
2 | Unmatched return defaultValue; |
3 | The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero |