while (iter.hasNext()) { Object temp = iter.next(); tree.add(temp); tree = tree.getTree(temp); }
while (iter.hasPrevious()) { PostProcessor ex = (PostProcessor) iter.previous(); TestBeanHelper.prepare((TestElement) ex); ex.process(); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jorphan/collections/HashTree.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/threads/JMeterThread.java
Method name: HashTree addTreePath(Collection) Method name: void runPostProcessors(List)
Number of AST nodes: 4 Number of AST nodes: 4
1
while (iter.hasNext()) {
1
while (iter.has
2
			Object temp = iter.next();
3
			tree.add(temp);
4
			tree = tree.getTree(temp);
2
Previous()) {
3
    			PostProcessor ex = (PostProcessor) iter.previous();
4
    			TestBeanHelper.prepare((TestElement) ex);
5
    			ex.process();
5
		}
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 in different classes
Number of node comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)379.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    while (iter.hasNext())
    3
    while (iter.hasNext())
    4
    while (iter.hasPrevious())
    Differences
    Expression1Expression2Difference
    hasNexthasPreviousMETHOD_INVOCATION_NAME_MISMATCH
    java.util.Iteratorjava.util.ListIteratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Iterator of variable iter does not match with type java.util.ListIterator of variable iter
    • Make classes java.util.Iterator and java.util.ListIterator extend a common superclass
    4
    while (iter.hasPrevious())
    4
    Object temp = iter.next();
    4
    Object temp = iter.next();
    Preondition Violations
    Unmatched statement Object temp=iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                          
                                                                                                          
    5
    PostProcessor ex = (PostProcessor)iter.previous();
    Preondition Violations
    Unmatched statement PostProcessor ex=(PostProcessor)iter.previous(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    PostProcessor ex = (PostProcessor)iter.previous();
    5
    tree.add(temp);
    5
    tree.add(temp);
    Preondition Violations
    Unmatched statement tree.add(temp); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                        
                                                                                          
    6
    TestBeanHelper.prepare((TestElement)ex);
    6
    tree = tree.getTree(temp);
    6
    tree = tree.getTree(temp);
    Preondition Violations
    Unmatched statement tree=tree.getTree(temp); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                          
                                    
    7
    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
    7
    ex.process();
    Precondition Violations (6)
    Row Violation
    1Type java.util.Iterator of variable iter does not match with type java.util.ListIterator of variable iter
    2Unmatched statement Object temp=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.previous(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement tree.add(temp); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement tree=tree.getTree(temp); 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