if (parent instanceof Controller && (child instanceof Sampler || child instanceof Controller)) { parent.addTestElement(child); }
if (currArgsMap.containsKey(name)) { String newVal = (String) currArgsMap.get(name); if (newVal != null && newVal.length() > 0) { value = newVal; } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/threads/TestCompiler.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/java/config/gui/JavaConfigGui.java
Method name: void addTestElements() Method name: void actionPerformed(ActionEvent)
Number of AST nodes: 2 Number of AST nodes: 4
1
if (parent instanceof Controller && (child instanceof Sampler || child instanceof Controller)) {
1
if (currArgsMap.contains
2
				parent.addTestElement(child);
2
Key(name)) {
3
							String newVal = (String) currArgsMap.get(name);
4
							if (newVal != null && newVal.length() > 0) {
5
								value = newVal;
6
							}
3
			}
7
						}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are in different classes
Number of node comparisons4
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)2.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                    
    19
    String newVal = (String)currArgsMap.get(name);
    Preondition Violations
    Unmatched statement String newVal=(String)currArgsMap.get(name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    19
    String newVal = (String)currArgsMap.get(name);
    1
    if (parent instanceof Controller && (child instanceof Sampler || child instanceof Controller))
    1
    if (parent instanceof Controller && (child instanceof Sampler || child instanceof Controller))
    20
    if (newVal != null && newVal.length() > 0)
    Differences
    Expression1Expression2Difference
    parent instanceof ControllernewVal != nullINFIX_LEFT_OPERAND_MISMATCH
    (child instanceof Sampler || child instanceof Controller)newVal.length() > 0INFIX_RIGHT_OPERAND_MISMATCH
    20
    if (newVal != null && newVal.length() > 0)
    2
    parent.addTestElement(child);
                                                                    
                                      
    21
    value = newVal;
    Precondition Violations (1)
    Row Violation
    1Unmatched statement String newVal=(String)currArgsMap.get(name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted