public Set<Command> getAction(String actionName) {
Set<Command> set = new HashSet<Command>();
for (Command c : commands.get(actionName)) {
try {
set.add(c);
} catch (Exception err) {
log.error("Could not add Command", err);
}
}
return set;
}
public Set<Command> getAction(String actionName) {
Set<Command> set = new HashSet<Command>();
Set<Command> commandObjects = commands.get(actionName);
Iterator<Command> iter = commandObjects.iterator();
while (iter.hasNext()) {
try {
set.add(iter.next());
} catch (Exception err) {
log.error("", err);
}
}
return set;
}
Clone fragments detected by clone detection tool
File path: /apache-jmeter-2.11/src/core/org/apache/jmeter/gui/action/ActionRouter.java
|
|
File path: /apache-jmeter-2.11/src/reports/org/apache/jmeter/report/gui/action/ReportActionRouter.java
|
Method name: Set getAction(String)
|
|
Method name: Set getAction(String)
|
Number of AST nodes: 2
|
|
Number of AST nodes: 2
|
|
1 | public Set<Command> getAction(String actionName) {
| | 1 | public Set<Command> getAction(String actionName) {
|
2 | Set<Command> set = new HashSet<Command>();
| | 2 | Set<Command> set = new HashSet<Command>();
|
3 | for (Command c : commands.get(actionName)) {
| | 3 | Set<Command> commandObjects = commands.get(actionName);
|
4 | try {
| | 4 | Iterator<Command> iter = commandObjects.iterator();
|
5 | set.add(c);
| | 5 | while (iter.hasNext()) {
|
6 | } catch (Exception err) {
| | 6 | try {
|
7 | log.error("Could not add Command", err);
| | 7 | set.add(iter.next());
|
8 | }
| | 8 | } catch (Exception err) {
|
9 | }
| | 9 | log.error("", err);
|
10 | return set;
| | 10 | }
|
11 | } | | 11 | }
|
| | | 12 | return set;
|
| | | 13 | } |
See real code fragment |
|
See real code fragment |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 4 |
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) | 0.0 |
Similarity Score | 0.500 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
2 | for (Command c : commands.get(actionName)) | | 4 | while (iter.hasNext()) |
3 | | | 5 | |
4 | | | 6 | |
Precondition Violations (1)
Row |
Violation |
1 | Expression c cannot be parameterized, because it has dependencies to/from statements that will be extracted |