if (selectedNode != null) { TreeNode[] path = selectedNode.getPath(); for (int i = 0; i < path.length; i++) { nodePath.add(((JMeterTreeNode) path[i]).getName()); } // nodePath.add(selectedNode.getName()); }
SampleResult[] subs = lastRes.getSubResults(); for (int i = 0; i < subs.length; i++) { totalRes.addSubResult(subs[i]); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/control/ModuleController.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
Method name: void setNodePath() Method name: HTTPSampleResult followRedirects(HTTPSampleResult, int)
Number of AST nodes: 4 Number of AST nodes: 3
1
if (selectedNode != null) {
2
			TreeNode[] path = selectedNode.getPath();
1
SampleResult[] subs = lastRes.getSubResults();
3
			for (int i = 0; i < path.length; i++) {
2
				for (int i = 0; i < subs.length; i++) {
4
				nodePath.add(((JMeterTreeNode) path[i]).getName());
3
				
5
			}
6
			// nodePath.add(selectedNode.getName());
4
	totalRes.addSubResult(subs[i]);
7
		}
5
				}
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.3
Clones locationClones are in different classes having the same super class
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    TreeNode[] path = selectedNode.getPath();
                                                                                        
                                                                                                    
    10
    SampleResult[] subs = lastRes.getSubResults();
    Preondition Violations
    Unmatched statement SampleResult[] subs=lastRes.getSubResults(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    SampleResult[] subs = lastRes.getSubResults();
    4
    for (int i = 0; i < path.length; i++)
    4
    for (int i = 0; i < path.length; i++)
    11
    for (int i = 0; i < subs.length; i++)
    Differences
    Expression1Expression2Difference
    pathsubsVARIABLE_NAME_MISMATCH
    javax.swing.tree.TreeNode[]org.apache.jmeter.samplers.SampleResult[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type javax.swing.tree.TreeNode[] of variable path does not match with type org.apache.jmeter.samplers.SampleResult[] of variable subs
    • Make classes javax.swing.tree.TreeNode[] and org.apache.jmeter.samplers.SampleResult[] extend a common superclass
    11
    for (int i = 0; i < subs.length; i++)
    5
    nodePath.add(((JMeterTreeNode)path[i]).getName());
    5
    nodePath.add(((JMeterTreeNode)path[i]).getName());
    Preondition Violations
    Unmatched statement nodePath.add(((JMeterTreeNode)path[i]).getName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                              
                                                                          
    12
    totalRes.addSubResult(subs[i]);
    Preondition Violations
    Unmatched statement totalRes.addSubResult(subs[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12
    totalRes.addSubResult(subs[i]);
    Precondition Violations (4)
    Row Violation
    1Unmatched statement SampleResult[] subs=lastRes.getSubResults(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Type javax.swing.tree.TreeNode[] of variable path does not match with type org.apache.jmeter.samplers.SampleResult[] of variable subs
    3Unmatched statement nodePath.add(((JMeterTreeNode)path[i]).getName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement totalRes.addSubResult(subs[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted