if (cookieManager != null) { Header hdr[] = method.getResponseHeaders(HEADER_SET_COOKIE); for (int i = 0; i < hdr.length; i++) { cookieManager.addCookieFromHeader(hdr[i].getValue(),u); } }
if (save.saveAssertions()) { AssertionResult[] assertionResults = res.getAssertionResults(); for (int i = 0; i < assertionResults.length; i++) { writeItem(assertionResults[i], context, writer); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/save/converters/SampleResultConverter.java
Method name: void saveConnectionCookies(HttpMethod, URL, CookieManager) Method name: void saveAssertions(HierarchicalStreamWriter, MarshallingContext, SampleResult, SampleSaveConfiguration)
Number of AST nodes: 4 Number of AST nodes: 4
1
if (cookieManager != null) {
1
if (
2
            Header hdr[] = method.getResponseHeaders(HEADER_SET_COOKIE);            
2
save.saveAssertions()) {
3
			AssertionResult[] assertionResults = res.getAssertionResults();
3
			for (int i = 0; i < hdr.length; i++) {
4
			for (int i = 0; i < assertionResults.length; i++) {
4
                cookieManager.addCookieFromHeader(hdr[i].getValue(),u);
5
				writeItem(assertionResults[i], context, writer);
5
			}
6
			}
6
		}
7
		}
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)1.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                    
    2
    AssertionResult[] assertionResults = res.getAssertionResults();
    2
    Header hdr[] = method.getResponseHeaders(HEADER_SET_COOKIE);
                                                                                                                              
    3
    for (int i = 0; i < hdr.length; i++)
    3
    for (int i = 0; i < hdr.length; i++)
    3
    for (int i = 0; i < assertionResults.length; i++)
    Differences
    Expression1Expression2Difference
    hdrassertionResultsVARIABLE_NAME_MISMATCH
    org.apache.commons.httpclient.Header[]org.apache.jmeter.assertions.AssertionResult[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.commons.httpclient.Header[] of variable hdr does not match with type org.apache.jmeter.assertions.AssertionResult[] of variable assertionResults
    • Make classes org.apache.commons.httpclient.Header[] and org.apache.jmeter.assertions.AssertionResult[] extend a common superclass
    3
    for (int i = 0; i < assertionResults.length; i++)
    4
    cookieManager.addCookieFromHeader(hdr[i].getValue(), u);
    4
    cookieManager.addCookieFromHeader(hdr[i].getValue(), u);
    4
    writeItem(assertionResults[i], context, writer);
    Differences
    Expression1Expression2Difference
    addCookieFromHeaderwriteItemMETHOD_INVOCATION_NAME_MISMATCH
    cookieManager.addCookieFromHeader(hdr[i].getValue(),u)writeItem(assertionResults[i],context,writer)ARGUMENT_NUMBER_MISMATCH
    cookieManagerMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression cookieManager.addCookieFromHeader(hdr[i].getValue(),u) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression writeItem(assertionResults[i],context,writer) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression cookieManager.addCookieFromHeader(hdr[i].getValue(),u) is a void method call, and thus it cannot be parameterized
    Expression writeItem(assertionResults[i],context,writer) is a void method call, and thus it cannot be parameterized
    Expression cookieManager.addCookieFromHeader(hdr[i].getValue(),u) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression writeItem(assertionResults[i],context,writer) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression cookieManager.addCookieFromHeader(hdr[i].getValue(),u) is a void method call, and thus it cannot be parameterized
    Expression writeItem(assertionResults[i],context,writer) is a void method call, and thus it cannot be parameterized
    4
    writeItem(assertionResults[i], context, writer);
    Precondition Violations (9)
    Row Violation
    1Type org.apache.commons.httpclient.Header[] of variable hdr does not match with type org.apache.jmeter.assertions.AssertionResult[] of variable assertionResults
    2Expression cookieManager.addCookieFromHeader(hdr[i].getValue(),u) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression writeItem(assertionResults[i],context,writer) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression cookieManager.addCookieFromHeader(hdr[i].getValue(),u) is a void method call, and thus it cannot be parameterized
    5Expression writeItem(assertionResults[i],context,writer) is a void method call, and thus it cannot be parameterized
    6Expression cookieManager.addCookieFromHeader(hdr[i].getValue(),u) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression writeItem(assertionResults[i],context,writer) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression cookieManager.addCookieFromHeader(hdr[i].getValue(),u) is a void method call, and thus it cannot be parameterized
    9Expression writeItem(assertionResults[i],context,writer) is a void method call, and thus it cannot be parameterized