SampleResult[] subs = lastRes.getSubResults(); for (int i = 0; i < subs.length; i++) { totalRes.addSubResult(subs[i]); }
while (d.next()) { for (int count = 0; count < headers.length; count++) { addColumnValue(headers[count], d.getColumnValue(headers[count])); } }
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/jorphan/collections/Data.java
Method name: HTTPSampleResult followRedirects(HTTPSampleResult, int) Method name: void append(Data)
Number of AST nodes: 3 Number of AST nodes: 3
1
SampleResult[] subs = lastRes.getSubResults();
1
while (d.next()) {
2
				for (int i = 0; i < subs.length; i++) {
2
				for (int count = 0; count < headers.length; count++) {
3
					totalRes.addSubResult(subs[i]);
3
					addColumnValue(headers[count], d.getColumnValue(headers[count]));
4
				}
4
				}
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.2
Clones locationClones are in different classes
Number of node comparisons7
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)11.3
    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++)
    13
    for (int count = 0; count < headers.length; count++)
    Differences
    Expression1Expression2Difference
    icountVARIABLE_NAME_MISMATCH
    icountVARIABLE_NAME_MISMATCH
    subsheadersVARIABLE_NAME_MISMATCH
    org.apache.jmeter.samplers.SampleResult[]java.lang.String[]VARIABLE_TYPE_MISMATCH
    icountVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.samplers.SampleResult[] of variable subs does not match with type java.lang.String[] of variable headers
    • Make classes org.apache.jmeter.samplers.SampleResult[] and java.lang.String[] extend a common superclass
    13
    for (int count = 0; count < headers.length; count++)
    12
    totalRes.addSubResult(subs[i]);
    12
    totalRes.addSubResult(subs[i]);
    14
    addColumnValue(headers[count], d.getColumnValue(headers[count]));
    Differences
    Expression1Expression2Difference
    addSubResultaddColumnValueMETHOD_INVOCATION_NAME_MISMATCH
    totalRes.addSubResult(subs[i])addColumnValue(headers[count],d.getColumnValue(headers[count]))ARGUMENT_NUMBER_MISMATCH
    totalResMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression totalRes.addSubResult(subs[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression addColumnValue(headers[count],d.getColumnValue(headers[count])) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression totalRes.addSubResult(subs[i]) is a void method call, and thus it cannot be parameterized
    Expression addColumnValue(headers[count],d.getColumnValue(headers[count])) is a void method call, and thus it cannot be parameterized
    Expression totalRes.addSubResult(subs[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression addColumnValue(headers[count],d.getColumnValue(headers[count])) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression totalRes.addSubResult(subs[i]) is a void method call, and thus it cannot be parameterized
    Expression addColumnValue(headers[count],d.getColumnValue(headers[count])) is a void method call, and thus it cannot be parameterized
    14
    addColumnValue(headers[count], d.getColumnValue(headers[count]));
    Precondition Violations (10)
    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 headers
    3Expression totalRes.addSubResult(subs[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression addColumnValue(headers[count],d.getColumnValue(headers[count])) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression totalRes.addSubResult(subs[i]) is a void method call, and thus it cannot be parameterized
    6Expression addColumnValue(headers[count],d.getColumnValue(headers[count])) is a void method call, and thus it cannot be parameterized
    7Expression totalRes.addSubResult(subs[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression addColumnValue(headers[count],d.getColumnValue(headers[count])) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression totalRes.addSubResult(subs[i]) is a void method call, and thus it cannot be parameterized
    10Expression addColumnValue(headers[count],d.getColumnValue(headers[count])) is a void method call, and thus it cannot be parameterized