if (save.saveAssertions()) { AssertionResult[] assertionResults = res.getAssertionResults(); for (int i = 0; i < assertionResults.length; i++) { writeItem(assertionResults[i], context, writer); } }
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/save/converters/SampleResultConverter.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
Method name: void saveAssertions(HierarchicalStreamWriter, MarshallingContext, SampleResult, SampleSaveConfiguration) Method name: HTTPSampleResult followRedirects(HTTPSampleResult, int)
Number of AST nodes: 4 Number of AST nodes: 3
1
if (save.saveAssertions()) {
2
			AssertionResult[] assertionResults = res.getAssertionResults();
1
SampleResult[] subs = lastRes.getSubResults();
3
			for (int i = 0; i < assertionResults.length; i++) {
2
				for (int i = 0; i < subs.length; i++) {
4
				writeItem(assertionResults[i], context, writer);
3
					totalRes.addSubResult(subs[i]);
5
			}
4
			
6
		}
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 comparisons6
  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 fragment1
    Time elapsed for statement mapping (ms)295.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    AssertionResult[] assertionResults = res.getAssertionResults();
                                                                                                                                    
                                                                                                    
    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();
    3
    for (int i = 0; i < assertionResults.length; i++)
    3
    for (int i = 0; i < assertionResults.length; i++)
    11
    for (int i = 0; i < subs.length; i++)
    Differences
    Expression1Expression2Difference
    assertionResultssubsVARIABLE_NAME_MISMATCH
    org.apache.jmeter.assertions.AssertionResult[]org.apache.jmeter.samplers.SampleResult[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.assertions.AssertionResult[] of variable assertionResults does not match with type org.apache.jmeter.samplers.SampleResult[] of variable subs
    • Make classes org.apache.jmeter.assertions.AssertionResult[] and org.apache.jmeter.samplers.SampleResult[] extend a common superclass
    11
    for (int i = 0; i < subs.length; i++)
    4
    writeItem(assertionResults[i], context, writer);
    4
    writeItem(assertionResults[i], context, writer);
    12
    totalRes.addSubResult(subs[i]);
    Differences
    Expression1Expression2Difference
    writeItemaddSubResultMETHOD_INVOCATION_NAME_MISMATCH
    writeItem(assertionResults[i],context,writer)totalRes.addSubResult(subs[i])ARGUMENT_NUMBER_MISMATCH
    totalResMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression writeItem(assertionResults[i],context,writer) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression totalRes.addSubResult(subs[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression writeItem(assertionResults[i],context,writer) is a void method call, and thus it cannot be parameterized
    Expression totalRes.addSubResult(subs[i]) is a void method call, and thus it cannot be parameterized
    Expression writeItem(assertionResults[i],context,writer) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression totalRes.addSubResult(subs[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression writeItem(assertionResults[i],context,writer) is a void method call, and thus it cannot be parameterized
    Expression totalRes.addSubResult(subs[i]) is a void method call, and thus it cannot be parameterized
    12
    totalRes.addSubResult(subs[i]);
    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.assertions.AssertionResult[] of variable assertionResults does not match with type org.apache.jmeter.samplers.SampleResult[] of variable subs
    3Expression writeItem(assertionResults[i],context,writer) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression totalRes.addSubResult(subs[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression writeItem(assertionResults[i],context,writer) is a void method call, and thus it cannot be parameterized
    6Expression totalRes.addSubResult(subs[i]) is a void method call, and thus it cannot be parameterized
    7Expression writeItem(assertionResults[i],context,writer) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression totalRes.addSubResult(subs[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression writeItem(assertionResults[i],context,writer) is a void method call, and thus it cannot be parameterized
    10Expression totalRes.addSubResult(subs[i]) is a void method call, and thus it cannot be parameterized