if (parent instanceof Sampler) {// Samplers and Controllers need not apply ... if (foundClass(nodes, new Class[]{Sampler.class, Controller.class})){ return false; } return true; }
if (parent instanceof TestPlan) { if (foundClass(nodes, new Class[]{Sampler.class, Controller.class}, // Samplers and Controllers need not apply ... org.apache.jmeter.threads.ThreadGroup.class) // but ThreadGroup (Controller) is OK ){ return false; } return true; }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/util/MenuFactory.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/util/MenuFactory.java
Method name: boolean canAddTo(JMeterTreeNode, JMeterTreeNode[]) Method name: boolean canAddTo(JMeterTreeNode, JMeterTreeNode[])
Number of AST nodes: 4 Number of AST nodes: 4
1
if (parent instanceof Sampler) {// Samplers and Controllers need not apply ...
1
if (parent instanceof 
2
			if (foundClass(nodes, new Class[]{Sampler.class, Controller.class})
2
TestPlan) {
3
			if (foundClass(nodes, 
4
					 new Class[]{Sampler.class, Controller.class}, // Samplers and Controllers need not apply ...
5
			         org.apache.jmeter.threads.ThreadGroup.class)  // but ThreadGroup (Controller) is OK
3
){
6
			    ){
4
				return false;
7
				return false;
5
			}
8
			}
6
			return true;
9
			return true;
7
		}
10
		}
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.5
Clones locationClones are in the same method
Number of node comparisons8
  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)1.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    18
    if (parent instanceof Sampler)
    18
    if (parent instanceof Sampler)
    10
    if (parent instanceof TestPlan)
    Differences
    Expression1Expression2Difference
    org.apache.jmeter.samplers.Samplerorg.apache.jmeter.testelement.TestPlanSUBCLASS_TYPE_MISMATCH
    10
    if (parent instanceof TestPlan)
    19
    if (foundClass(nodes, new Class[] {Sampler.class, Controller.class}))
    19
    if (foundClass(nodes, new Class[] {Sampler.class, Controller.class}))
    11
    if (foundClass(nodes, new Class[] {Sampler.class, Controller.class}, org.apache.jmeter.threads.ThreadGroup.class))
    Differences
    Expression1Expression2Difference
    foundClass(nodes,new Class[]{Sampler.class,Controller.class})foundClass(nodes,new Class[]{Sampler.class,Controller.class},org.apache.jmeter.threads.ThreadGroup.class)ARGUMENT_NUMBER_MISMATCH
    11
    if (foundClass(nodes, new Class[] {Sampler.class, Controller.class}, org.apache.jmeter.threads.ThreadGroup.class))
    20
    return false;
    12
    return false;
    21
    return true;
    13
    return true;
    Precondition Violations (1)
    Row Violation
    1Not all possible execution flows end in a return statement