Set commandObjects = (Set) commands.get(actionName); Iterator iter = commandObjects.iterator(); while (iter.hasNext()) { try { Command com = (Command) iter.next(); if (com.getClass().equals(actionClass)) { return com; } } catch (Exception err) { log.error("", err); } } return null;
Set commandObjects = (Set) commands.get(actionName); Iterator iter = commandObjects.iterator(); while (iter.hasNext()) { try { Command com = (Command) iter.next(); if (com.getClass().getName().equals(className)) { return com; } } catch (Exception err) { log.error("", err); } } return null;
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/report/gui/action/ReportActionRouter.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/action/ActionRouter.java
Method name: Command getAction(String, Class) Method name: Command getAction(String, String)
Number of AST nodes: 8 Number of AST nodes: 8
1
Set commandObjects = (Set) commands.get(actionName);
1
Set commandObjects = (Set) commands.get(actionName);
2
		Iterator iter = commandObjects.iterator();
2
		Iterator iter = commandObjects.iterator();
3
		while (iter.hasNext()) {
3
		while (iter.hasNext()) {
4
			try {
4
			try {
5
				Command com = (Command) iter.next();
5
				Command com = (Command) iter.next();
6
				if (com.getClass().equals(actionClass)) {
6
				if (com.getClass().getName().equals(className)) {
7
					return com;
7
					return com;
8
				}
8
				}
9
			} catch (Exception err) {
9
			} catch (Exception err) {
10
				log.error("", err);
10
				log.error("", err);
11
			}
11
			}
12
		}
12
		}
13
		return null;
13
		return null;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.4
Clones locationClones are in different classes
Number of node comparisons11
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)16.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    Set commandObjects = (Set)commands.get(actionName);
    1
    Set commandObjects = (Set)commands.get(actionName);
    2
    Iterator iter = commandObjects.iterator();
    2
    Iterator iter = commandObjects.iterator();
    3
    while (iter.hasNext())
    3
    while (iter.hasNext())
    4
    try
    4
    try
    5
    Command com = (Command)iter.next();
    5
    Command com = (Command)iter.next();
                                                                                                      
    6
    if (com.getClass().getName().equals(className))
    Preondition Violations
    Unmatched statement if(com.getClass().getName().equals(className)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    if (com.getClass().getName().equals(className))
                                
    7
    return com;
    Preondition Violations
    Unmatched statement return com; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return com;
    7
    return com;
    6
    if (com.getClass().equals(actionClass))
    6
    if (com.getClass().equals(actionClass))
    Preondition Violations
    Unmatched statement if(com.getClass().equals(actionClass)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                      
    7
    return com;
    7
    return com;
    Preondition Violations
    Unmatched statement return com; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return com;
                                
    8
    return null;
    8
    return null;
    Precondition Violations (6)
    Row Violation
    1Unmatched statement if(com.getClass().getName().equals(className)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement return com; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched return com;
    4Unmatched statement if(com.getClass().equals(actionClass)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement return com; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched return com;