File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/functions/IntSum.java | File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/functions/LongSum.java | |||
Method name: String execute(SampleResult, Sampler)
|
Method name: String execute(SampleResult, Sampler)
|
|||
Number of AST nodes: 6 | Number of AST nodes: 6 | |||
1 | for (int i = 0; i < values.length - 1; i++) {↵ | 1 | for (int i = 0; i < values.length - 1; i++) {↵ | |
2 | sum += Integer.parseInt(((CompoundVariable) values[i]).execute());↵ | 2 | sum += Long.parseLong(((CompoundVariable) values[i]).execute());↵ | |
3 | }↵ | 3 | }↵ | |
4 | try {↵ | 4 | try {↵ | |
5 | sum += Integer.parseInt(varName);↵ | 5 | sum += Long.parseLong(varName);↵ | |
6 | varName = null; // there is no variable name↵ | 6 | varName = null; // there is no variable name↵ | |
7 | } catch (NumberFormatException ignored) {↵ | 7 | } catch (NumberFormatException ignored) {↵ | |
8 | }↵ | 8 | }↵ | |
9 | ↵ | 9 | ↵ | |
10 | String totalString = Integer.toString(sum); | 10 | String totalString = Long.toString(sum); | |
See real code fragment | See real code fragment |
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 in different classes having the same super class |
Number of node comparisons | 16 |
Number of mapped statements | 4 |
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) | 2.6 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4 | for (int i = 0; i < values.length - 1; i++) | 4 | for (int i = 0; i < values.length - 1; i++) | ||||||||||||||||
|
| 5 | sum += Long.parseLong(((CompoundVariable)values[i]).execute()); | ||||||||||||||||
5 | sum += Integer.parseInt(((CompoundVariable)values[i]).execute()); |
| | ||||||||||||||||
6 | try | 6 | try | ||||||||||||||||
|
| 7 | sum += Long.parseLong(varName); | ||||||||||||||||
7 | sum += Integer.parseInt(varName); |
| | ||||||||||||||||
8 | varName = null; | 8 | varName = null; | ||||||||||||||||
9 | String totalString = Integer.toString(sum); |
| 9 | String totalString = Long.toString(sum); |
Row | Violation |
---|---|
1 | Unmatched statement sum+=Long.parseLong(((CompoundVariable)values[i]).execute()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement sum+=Long.parseLong(((CompoundVariable)values[i]).execute()); 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 | Unmatched statement sum+=Integer.parseInt(((CompoundVariable)values[i]).execute()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement sum+=Integer.parseInt(((CompoundVariable)values[i]).execute()); 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 |
5 | Unmatched statement sum+=Long.parseLong(varName); 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 |
6 | Unmatched statement sum+=Integer.parseInt(varName); 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 |
7 | Type int of variable sum does not match with type long of variable sum |
8 | Expression Integer cannot be unified with expression Long , because common superclass java.lang.Number does not declare member(s) public static java.lang.String toString(int) , public static java.lang.String toString(long) |
9 | Clone fragment #1 returns variables i, varName, totalString , while Clone fragment #2 returns variables i, varName, totalString |