SampleResult[] subs = lastRes.getSubResults(); for (int i = 0; i < subs.length; i++) { totalRes.addSubResult(subs[i]); }
for(int i = 0; i < variableNames.length; i++){ values[i] = vars.get(variableNames[i]); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/samplers/SampleEvent.java
Method name: HTTPSampleResult followRedirects(HTTPSampleResult, int) Method name: void saveVars(JMeterVariables)
Number of AST nodes: 3 Number of AST nodes: 2
1
SampleResult[] subs = lastRes.getSubResults();
2
				for (int i = 0; i < subs.length; i++) {
1
for(int i = 0; i < variableNames.length; i++){
3
					totalRes.addSubResult(subs[i]);
2
			values[i] = vars.get(variableNames[i]);
4
				}
3
		}
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.2
Clones locationClones are in different classes
Number of node comparisons5
  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 fragment1
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    10
    SampleResult[] subs = lastRes.getSubResults();
    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
                                                                                                    
    11
    for (int i = 0; i < subs.length; i++)
    11
    for (int i = 0; i < subs.length; i++)
    1
    for (int i = 0; i < variableNames.length; i++)
    Differences
    Expression1Expression2Difference
    subsvariableNamesVARIABLE_NAME_MISMATCH
    org.apache.jmeter.samplers.SampleResult[]java.lang.String[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.samplers.SampleResult[] of variable subs does not match with type java.lang.String[] of variable variableNames
    • Make classes org.apache.jmeter.samplers.SampleResult[] and java.lang.String[] extend a common superclass
    1
    for (int i = 0; i < variableNames.length; i++)
                                                                                    
    2
    values[i] = vars.get(variableNames[i]);
    Preondition Violations
    Unmatched statement values[i]=vars.get(variableNames[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2
    values[i] = vars.get(variableNames[i]);
    12
    totalRes.addSubResult(subs[i]);
    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
                                                                          
    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 org.apache.jmeter.samplers.SampleResult[] of variable subs does not match with type java.lang.String[] of variable variableNames
    3Unmatched statement values[i]=vars.get(variableNames[i]); 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