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
    }
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Similarity Score0.500
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    for (Command c : commands.get(actionName))
    2
    for (Command c : commands.get(actionName))
    4
    while (iter.hasNext())
    Differences
    Expression1Expression2Difference
    commands.get(actionName)commandObjectsTYPE_COMPATIBLE_REPLACEMENT
    4
    while (iter.hasNext())
    3
    try
    3
    try
    5
    try
    Differences
    Expression1Expression2Difference
    "Could not add Command"""LITERAL_VALUE_MISMATCH
    5
    try
    4
    set.add(c);
    4
    set.add(c);
    6
    set.add(iter.next());
    Differences
    Expression1Expression2Difference
    citer.next()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression c cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    set.add(iter.next());
    Precondition Violations (1)
    Row Violation
    1Expression c cannot be parameterized, because it has dependencies to/from statements that will be extracted