String dataSentToMirrorServer = new String(res.getResponseData(), EncoderCache.URL_ARGUMENT_ENCODING); int posDividerHeadersAndBody = getPositionOfBody(dataSentToMirrorServer); String headersSent = null; String bodySent = null; if(posDividerHeadersAndBody >= 0) { headersSent = dataSentToMirrorServer.substring(0, posDividerHeadersAndBody); // Skip the blank line with crlf dividing headers and body bodySent = dataSentToMirrorServer.substring(posDividerHeadersAndBody+2); } else { fail("No header and body section found"); }
String dataSentToMirrorServer = new String(res.getResponseData(), contentEncoding); int posDividerHeadersAndBody = getPositionOfBody(dataSentToMirrorServer); String headersSent = null; String bodySent = null; if(posDividerHeadersAndBody >= 0) { headersSent = dataSentToMirrorServer.substring(0, posDividerHeadersAndBody); // Skip the blank line with crlf dividing headers and body bodySent = dataSentToMirrorServer.substring(posDividerHeadersAndBody+2); } else { fail("No header and body section found"); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java
Method name: void checkGetRequest_Parameters(HTTPSamplerBase, HTTPSampleResult, String, URL, String, String, String, String, boolean) Method name: void checkPostRequestFormMultipart(HTTPSamplerBase, HTTPSampleResult, String, String, String, String, String, String)
Number of AST nodes: 8 Number of AST nodes: 8
1
String dataSentToMirrorServer = new String(res.getResponseData(), EncoderCache.URL_ARGUMENT_ENCODING);
1
String dataSentToMirrorServer = new String(res.getResponseData(), contentEncoding);
2
        int posDividerHeadersAndBody = getPositionOfBody(dataSentToMirrorServer);
2
        int posDividerHeadersAndBody = getPositionOfBody(dataSentToMirrorServer);
3
        String headersSent = null;
3
        String headersSent = null;
4
        String bodySent = null;
4
        String bodySent = null;
5
        if(posDividerHeadersAndBody >= 0) {
5
        if(posDividerHeadersAndBody >= 0) {
6
            headersSent = dataSentToMirrorServer.substring(0, posDividerHeadersAndBody);
6
            headersSent = dataSentToMirrorServer.substring(0, posDividerHeadersAndBody);
7
            // Skip the blank line with crlf dividing headers and body
7
            // Skip the blank line with crlf dividing headers and body
8
            bodySent = dataSentToMirrorServer.substring(posDividerHeadersAndBody+2);
8
            bodySent = dataSentToMirrorServer.substring(posDividerHeadersAndBody+2);
9
        }
9
        }
10
        else {
10
        else {
11
            fail("No header and body section found");
11
            fail("No header and body section found");
12
        }
12
        }
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 declared in the same class
Number of node comparisons26
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    11
    String dataSentToMirrorServer = new String(res.getResponseData(), EncoderCache.URL_ARGUMENT_ENCODING);
    11
    String dataSentToMirrorServer = new String(res.getResponseData(), EncoderCache.URL_ARGUMENT_ENCODING);
    9
    String dataSentToMirrorServer = new String(res.getResponseData(), contentEncoding);
    Differences
    Expression1Expression2Difference
    EncoderCache.URL_ARGUMENT_ENCODINGcontentEncodingTYPE_COMPATIBLE_REPLACEMENT
    9
    String dataSentToMirrorServer = new String(res.getResponseData(), contentEncoding);
    12
    int posDividerHeadersAndBody = getPositionOfBody(dataSentToMirrorServer);
    10
    int posDividerHeadersAndBody = getPositionOfBody(dataSentToMirrorServer);
    13
    String headersSent = null;
    11
    String headersSent = null;
    14
    String bodySent = null;
    12
    String bodySent = null;
    15
    if (posDividerHeadersAndBody >= 0)
    13
    if (posDividerHeadersAndBody >= 0)
    16
    headersSent = dataSentToMirrorServer.substring(0, posDividerHeadersAndBody);
    14
    headersSent = dataSentToMirrorServer.substring(0, posDividerHeadersAndBody);
    17
    bodySent = dataSentToMirrorServer.substring(posDividerHeadersAndBody + 2);
    15
    bodySent = dataSentToMirrorServer.substring(posDividerHeadersAndBody + 2);
    else
    else
    18
    fail("No header and body section found");
    16
    fail("No header and body section found");
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables bodySent, headersSent , while Clone fragment #2 returns variables headersSent, bodySent