Iterator iter = iterationListeners.iterator(); LoopIterationEvent event = new LoopIterationEvent(this, getIterCount()); while (iter.hasNext()) { LoopIterationListener item = (LoopIterationListener) iter.next(); item.iterationStart(event); }
synchronized (sampleStore) { Iterator i = sampleStore.iterator(); while (i.hasNext()) { SampleEvent se = (SampleEvent) i.next(); listener.sampleOccurred(se); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/control/GenericController.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/samplers/HoldSampleSender.java
Method name: void fireIterationStart() Method name: void testEnded()
Number of AST nodes: 5 Number of AST nodes: 5
1
Iterator iter = iterationListeners.iterator();
2
		LoopIterationEvent event = new LoopIterationEvent(this, getIterCount
1
synchronized (sampleStore) {
3
());
2
				Iterator i = sampleStore.iterator();
4
		while (iter.hasNext()) {
3
				while (i.hasNext()) {
5
			LoopIterationListener item = (LoopIterationListener) iter.next();
4
			
6
			item.iterationStart(event);
5
		SampleEvent se = (SampleEvent) i.next();
6
					listener.sampleOccurred(se);
7
				}
7
		}
8
			}
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 comparisons11
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)3.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    Iterator iter = iterationListeners.iterator();
    1
    Iterator iter = iterationListeners.iterator();
    4
    Iterator i = sampleStore.iterator();
    Differences
    Expression1Expression2Difference
    iteriVARIABLE_NAME_MISMATCH
    iterationListenerssampleStoreVARIABLE_NAME_MISMATCH
    java.util.LinkedListjava.util.ListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.LinkedList of variable iterationListeners does not match with type java.util.List of variable sampleStore
    • Make classes java.util.LinkedList and java.util.List extend a common superclass
    4
    Iterator i = sampleStore.iterator();
    2
    LoopIterationEvent event = new LoopIterationEvent(this, getIterCount());
                                                                                                                                                    
    3
    while (iter.hasNext())
    3
    while (iter.hasNext())
    5
    while (i.hasNext())
    Differences
    Expression1Expression2Difference
    iteriVARIABLE_NAME_MISMATCH
    5
    while (i.hasNext())
    4
    LoopIterationListener item = (LoopIterationListener)iter.next();
    4
    LoopIterationListener item = (LoopIterationListener)iter.next();
    Preondition Violations
    Unmatched statement LoopIterationListener item=(LoopIterationListener)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                      
    5
    item.iterationStart(event);
    5
    item.iterationStart(event);
    Preondition Violations
    Unmatched statement item.iterationStart(event); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                
                                                                                    
    6
    SampleEvent se = (SampleEvent)i.next();
    Preondition Violations
    Unmatched statement SampleEvent se=(SampleEvent)i.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    SampleEvent se = (SampleEvent)i.next();
                                                                  
    7
    listener.sampleOccurred(se);
    Preondition Violations
    Unmatched statement listener.sampleOccurred(se); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    listener.sampleOccurred(se);
    Precondition Violations (5)
    Row Violation
    1Type java.util.LinkedList of variable iterationListeners does not match with type java.util.List of variable sampleStore
    2Unmatched statement LoopIterationListener item=(LoopIterationListener)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement item.iterationStart(event); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement SampleEvent se=(SampleEvent)i.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement listener.sampleOccurred(se); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted