if(firstMultipart) { output.write(DASH_DASH); output.write(boundaryString.getBytes(httpEncoding)); output.write(CRLF); } // replace all backslash with double backslash String filename = file.getName(); output.write("Content-Disposition: form-data; name=\"".getBytes(httpEncoding)); output.write(fileField.getBytes(httpEncoding)); output.write(("\"; filename=\"" + filename + "\"").getBytes(httpEncoding)); output.write(CRLF); output.write("Content-Type: ".getBytes(httpEncoding)); output.write(mimeType.getBytes(httpEncoding)); output.write(CRLF); output.write("Content-Transfer-Encoding: binary".getBytes(httpEncoding)); output.write(CRLF); output.write(CRLF); output.write(fileContent); output.write(CRLF); output.write(DASH_DASH); output.write(boundaryString.getBytes(httpEncoding)); if(lastMultipart) { output.write(DASH_DASH); } output.write(CRLF); output.flush(); output.close(); return output.toByteArray();
if(firstMultipart) { output.write(DASH_DASH); output.write(boundaryString.getBytes(ISO_8859_1)); output.write(CRLF); } // replace all backslash with double backslash String filename = file.getName(); output.write("Content-Disposition: form-data; name=\"".getBytes(ISO_8859_1)); output.write(fileField.getBytes(ISO_8859_1)); output.write(("\"; filename=\"" + filename + "\"").getBytes(ISO_8859_1)); output.write(CRLF); output.write("Content-Type: ".getBytes(ISO_8859_1)); output.write(mimeType.getBytes(ISO_8859_1)); output.write(CRLF); output.write("Content-Transfer-Encoding: binary".getBytes(ISO_8859_1)); output.write(CRLF); output.write(CRLF); output.write(fileContent); output.write(CRLF); output.write(DASH_DASH); output.write(boundaryString.getBytes(ISO_8859_1)); if(lastMultipart) { output.write(DASH_DASH); } output.write(CRLF); output.flush(); output.close(); return output.toByteArray();
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java
Method name: byte[] createExpectedFilepartOutput(String, String, File, String, byte[], boolean, boolean) Method name: byte[] createExpectedFilepartOutput(String, String, File, String, byte[], boolean, boolean)
Number of AST nodes: 25 Number of AST nodes: 25
1
if(firstMultipart) {
1
if(firstMultipart) {
2
            output.write(DASH_DASH);
2
            output.write(DASH_DASH);
3
            output.write(boundaryString.getBytes(httpEncoding));
3
            output.write(boundaryString.getBytes(ISO_8859_1));
4
            output.write(CRLF);
4
            output.write(CRLF);
5
        }
5
        }
6
        // replace all backslash with double backslash
6
        // replace all backslash with double backslash
7
        String filename = file.getName();
7
        String filename = file.getName();
8
        output.write("Content-Disposition: form-data; name=\"".getBytes(httpEncoding));
8
        output.write("Content-Disposition: form-data; name=\"".getBytes(ISO_8859_1));
9
        output.write(fileField.getBytes(httpEncoding));
9
        output.write(fileField.getBytes(ISO_8859_1));
10
        output.write(("\"; filename=\"" + filename + "\"").getBytes(httpEncoding));
10
        output.write(("\"; filename=\"" + filename + "\"").getBytes(ISO_8859_1));
11
        output.write(CRLF);
11
        output.write(CRLF);
12
        output.write("Content-Type: ".getBytes(httpEncoding));
12
        output.write("Content-Type: ".getBytes(ISO_8859_1));
13
        output.write(mimeType.getBytes(httpEncoding));
13
        output.write(mimeType.getBytes(ISO_8859_1));
14
        output.write(CRLF);
14
        output.write(CRLF);
15
        output.write("Content-Transfer-Encoding: binary".getBytes(httpEncoding));
15
        output.write("Content-Transfer-Encoding: binary".getBytes(ISO_8859_1));
16
        output.write(CRLF);
16
        output.write(CRLF);
17
        output.write(CRLF);
17
        output.write(CRLF);
18
        output.write(fileContent);
18
        output.write(fileContent);
19
        output.write(CRLF);
19
        output.write(CRLF);
20
        output.write(DASH_DASH);
20
        output.write(DASH_DASH);
21
        output.write(boundaryString.getBytes(httpEncoding));
21
        output.write(boundaryString.getBytes(ISO_8859_1));
22
        if(lastMultipart) {
22
        if(lastMultipart) {
23
            output.write(DASH_DASH);
23
            output.write(DASH_DASH);
24
        }
24
        }
25
        output.write(CRLF);
25
        output.write(CRLF);
26
        
26
        
27
        output.flush();
27
        output.flush();
28
        output.close();
28
        output.close();
29
        return output.toByteArray();
29
        return output.toByteArray();
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes having the same super class
Number of node comparisons234
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements25
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)35.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    if (firstMultipart)
    3
    if (firstMultipart)
    5
    output.write(DASH_DASH);
    4
    output.write(DASH_DASH);
    6
    output.write(boundaryString.getBytes(httpEncoding));
    6
    output.write(boundaryString.getBytes(httpEncoding));
    5
    output.write(boundaryString.getBytes(ISO_8859_1));
    Differences
    Expression1Expression2Difference
    httpEncodingISO_8859_1VARIABLE_NAME_MISMATCH
    5
    output.write(boundaryString.getBytes(ISO_8859_1));
    7
    output.write(CRLF);
    6
    output.write(CRLF);
    8
    String filename = file.getName();
    7
    String filename = file.getName();
    9
    output.write("Content-Disposition: form-data; name=\"".getBytes(httpEncoding));
    9
    output.write("Content-Disposition: form-data; name=\"".getBytes(httpEncoding));
    8
    output.write("Content-Disposition: form-data; name=\"".getBytes(ISO_8859_1));
    Differences
    Expression1Expression2Difference
    httpEncodingISO_8859_1VARIABLE_NAME_MISMATCH
    8
    output.write("Content-Disposition: form-data; name=\"".getBytes(ISO_8859_1));
    10
    output.write(fileField.getBytes(httpEncoding));
    10
    output.write(fileField.getBytes(httpEncoding));
    9
    output.write(fileField.getBytes(ISO_8859_1));
    Differences
    Expression1Expression2Difference
    httpEncodingISO_8859_1VARIABLE_NAME_MISMATCH
    9
    output.write(fileField.getBytes(ISO_8859_1));
    11
    output.write(("\"; filename=\"" + filename + "\"").getBytes(httpEncoding));
    11
    output.write(("\"; filename=\"" + filename + "\"").getBytes(httpEncoding));
    10
    output.write(("\"; filename=\"" + filename + "\"").getBytes(ISO_8859_1));
    Differences
    Expression1Expression2Difference
    httpEncodingISO_8859_1VARIABLE_NAME_MISMATCH
    10
    output.write(("\"; filename=\"" + filename + "\"").getBytes(ISO_8859_1));
    12
    output.write(CRLF);
    11
    output.write(CRLF);
    13
    output.write("Content-Type: ".getBytes(httpEncoding));
    13
    output.write("Content-Type: ".getBytes(httpEncoding));
    12
    output.write("Content-Type: ".getBytes(ISO_8859_1));
    Differences
    Expression1Expression2Difference
    httpEncodingISO_8859_1VARIABLE_NAME_MISMATCH
    12
    output.write("Content-Type: ".getBytes(ISO_8859_1));
    14
    output.write(mimeType.getBytes(httpEncoding));
    14
    output.write(mimeType.getBytes(httpEncoding));
    13
    output.write(mimeType.getBytes(ISO_8859_1));
    Differences
    Expression1Expression2Difference
    httpEncodingISO_8859_1VARIABLE_NAME_MISMATCH
    13
    output.write(mimeType.getBytes(ISO_8859_1));
    15
    output.write(CRLF);
    14
    output.write(CRLF);
    16
    output.write("Content-Transfer-Encoding: binary".getBytes(httpEncoding));
    16
    output.write("Content-Transfer-Encoding: binary".getBytes(httpEncoding));
    15
    output.write("Content-Transfer-Encoding: binary".getBytes(ISO_8859_1));
    Differences
    Expression1Expression2Difference
    httpEncodingISO_8859_1VARIABLE_NAME_MISMATCH
    15
    output.write("Content-Transfer-Encoding: binary".getBytes(ISO_8859_1));
    17
    output.write(CRLF);
    16
    output.write(CRLF);
    18
    output.write(CRLF);
    17
    output.write(CRLF);
    19
    output.write(fileContent);
    18
    output.write(fileContent);
    20
    output.write(CRLF);
    19
    output.write(CRLF);
    21
    output.write(DASH_DASH);
    20
    output.write(DASH_DASH);
    22
    output.write(boundaryString.getBytes(httpEncoding));
    22
    output.write(boundaryString.getBytes(httpEncoding));
    21
    output.write(boundaryString.getBytes(ISO_8859_1));
    Differences
    Expression1Expression2Difference
    httpEncodingISO_8859_1VARIABLE_NAME_MISMATCH
    21
    output.write(boundaryString.getBytes(ISO_8859_1));
    23
    if (lastMultipart)
    22
    if (lastMultipart)
    24
    output.write(DASH_DASH);
    23
    output.write(DASH_DASH);
    25
    output.write(CRLF);
    24
    output.write(CRLF);
    26
    output.flush();
    25
    output.flush();
    27
    output.close();
    26
    output.close();
    28
    return output.toByteArray();
    27
    return output.toByteArray();
    Precondition Violations (0)
    Row Violation