while (iter.hasNext()) { PostProcessor ex = (PostProcessor) iter.next(); TestBeanHelper.prepare((TestElement) ex); ex.process(); }
while (iter.hasNext()) { Timer timer = (Timer) iter.next(); TestBeanHelper.prepare((TestElement) timer); sum += timer.delay(); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/threads/JMeterThread.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/threads/JMeterThread.java
Method name: void runPostProcessors(List) Method name: void delay(List)
Number of AST nodes: 4 Number of AST nodes: 4
1
while (iter.hasNext()) {
1
while (iter.hasNext()) {
2
                PostProcessor ex = (PostProcessor) iter.next();
2
			Timer timer = (Timer) iter.next();
3
                TestBeanHelper.prepare((TestElement) ex);
3
			TestBeanHelper.prepare((TestElement) 
4
                ex.process();
5
            
4
timer);
5
			sum += timer.delay();
6
}
6
		}
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 declared in the same class
Number of node comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)4.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    9
    while (iter.hasNext())
    9
    while (iter.hasNext())
    3
    while (iter.hasNext())
    Differences
    Expression1Expression2Difference
    java.util.ListIteratorjava.util.IteratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.ListIterator of variable iter does not match with type java.util.Iterator of variable iter
    • Make classes java.util.ListIterator and java.util.Iterator extend a common superclass
    3
    while (iter.hasNext())
                                                                        
    4
    Timer timer = (Timer)iter.next();
    Preondition Violations
    Unmatched statement Timer timer=(Timer)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    Timer timer = (Timer)iter.next();
    10
    PostProcessor ex = (PostProcessor)iter.next();
    10
    PostProcessor ex = (PostProcessor)iter.next();
    Preondition Violations
    Unmatched statement PostProcessor ex=(PostProcessor)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                    
    11
    TestBeanHelper.prepare((TestElement)ex);
    11
    TestBeanHelper.prepare((TestElement)ex);
    5
    TestBeanHelper.prepare((TestElement)timer);
    Differences
    Expression1Expression2Difference
    extimerVARIABLE_NAME_MISMATCH
    org.apache.jmeter.processor.PostProcessororg.apache.jmeter.timers.TimerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.processor.PostProcessor of variable ex does not match with type org.apache.jmeter.timers.Timer of variable timer
    • Make classes org.apache.jmeter.processor.PostProcessor and org.apache.jmeter.timers.Timer extend a common superclass
    5
    TestBeanHelper.prepare((TestElement)timer);
                                                
    6
    sum += timer.delay();
    Preondition Violations
    Unmatched statement sum+=timer.delay(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    sum += timer.delay();
    12
    ex.process();
    12
    ex.process();
    Preondition Violations
    Unmatched statement ex.process(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                      
    Precondition Violations (6)
    Row Violation
    1Type java.util.ListIterator of variable iter does not match with type java.util.Iterator of variable iter
    2Unmatched statement Timer timer=(Timer)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement PostProcessor ex=(PostProcessor)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type org.apache.jmeter.processor.PostProcessor of variable ex does not match with type org.apache.jmeter.timers.Timer of variable timer
    5Unmatched statement sum+=timer.delay(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement ex.process(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted