output.write("Content-Disposition: form-data; name=\"".getBytes(HTTP_ENCODING)); output.write(titleField.getBytes(HTTP_ENCODING)); output.write("\"".getBytes(HTTP_ENCODING)); output.write(CRLF); output.write("Content-Type: ".getBytes(HTTP_ENCODING)); output.write(mimeType.getBytes(HTTP_ENCODING)); output.write("; charset=".getBytes(HTTP_ENCODING)); output.write((contentEncoding==null ? PostWriter.ENCODING : contentEncoding).getBytes(HTTP_ENCODING)); output.write(CRLF); output.write("Content-Transfer-Encoding: 8bit".getBytes(HTTP_ENCODING)); output.write(CRLF); output.write(CRLF); if(contentEncoding != null) { output.write(titleValue.getBytes(contentEncoding)); } else { output.write(titleValue.getBytes()); } output.write(CRLF); output.write(DASH_DASH); output.write(boundaryString.getBytes(HTTP_ENCODING));
output.write("Content-Disposition: form-data; name=\"".getBytes(HTTP_ENCODING)); output.write(descriptionField.getBytes(HTTP_ENCODING)); output.write("\"".getBytes(HTTP_ENCODING)); output.write(CRLF); output.write("Content-Type: ".getBytes(HTTP_ENCODING)); output.write(mimeType.getBytes(HTTP_ENCODING)); output.write("; charset=".getBytes(HTTP_ENCODING)); output.write((contentEncoding==null ? PostWriter.ENCODING : contentEncoding).getBytes(HTTP_ENCODING)); output.write(CRLF); output.write("Content-Transfer-Encoding: 8bit".getBytes(HTTP_ENCODING)); output.write(CRLF); output.write(CRLF); if(contentEncoding != null) { output.write(descriptionValue.getBytes(contentEncoding)); } else { output.write(descriptionValue.getBytes()); } output.write(CRLF); output.write(DASH_DASH); output.write(boundaryString.getBytes(HTTP_ENCODING));
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/PostWriterTest.java
Method name: byte[] createExpectedFormdataOutput(String, String, String, String, String, String, boolean, boolean) Method name: byte[] createExpectedFormdataOutput(String, String, String, String, String, String, boolean, boolean)
Number of AST nodes: 18 Number of AST nodes: 18
1
output.write("Content-Disposition: form-data; name=\"".getBytes(HTTP_ENCODING));
1
output.write("Content-Disposition: form-data; name=\"".getBytes(HTTP_ENCODING));
2
        output.write(titleField.getBytes(HTTP_ENCODING));
2
        output.write(descriptionField.getBytes(HTTP_ENCODING));
3
        output.write("\"".getBytes(HTTP_ENCODING));
3
        output.write("\"".getBytes(HTTP_ENCODING));
4
        output.write(CRLF);
4
        output.write(CRLF);
5
        output.write("Content-Type: ".getBytes(HTTP_ENCODING));
5
        output.write("Content-Type: ".getBytes(HTTP_ENCODING));
6
        output.write(mimeType.getBytes(HTTP_ENCODING));
6
        output.write(mimeType.getBytes(HTTP_ENCODING));
7
        output.write("; charset=".getBytes(HTTP_ENCODING));
7
        output.write("; charset=".getBytes(HTTP_ENCODING));
8
        output.write((contentEncoding==null ? PostWriter.ENCODING : contentEncoding).getBytes(HTTP_ENCODING));
8
        output.write((contentEncoding==null ? PostWriter.ENCODING : contentEncoding).getBytes(HTTP_ENCODING));
9
        output.write(CRLF);
9
        output.write(CRLF);
10
        output.write("Content-Transfer-Encoding: 8bit".getBytes(HTTP_ENCODING));
10
        output.write("Content-Transfer-Encoding: 8bit".getBytes(HTTP_ENCODING));
11
        output.write(CRLF);
11
        output.write(CRLF);
12
        output.write(CRLF);
12
        output.write(CRLF);
13
        if(contentEncoding != null) {
13
        if(contentEncoding != null) {
14
            output.write(titleValue.getBytes(contentEncoding));
14
            output.write(descriptionValue.getBytes(contentEncoding));
15
        }
15
        }
16
        else {
16
        else {
17
            output.write(titleValue.getBytes());
17
            output.write(descriptionValue.getBytes());
18
        }
18
        }
19
        output.write(CRLF);
19
        output.write(CRLF);
20
        output.write(DASH_DASH);
20
        output.write(DASH_DASH);
21
        output.write(boundaryString.getBytes(HTTP_ENCODING));
21
        output.write(boundaryString.getBytes(HTTP_ENCODING));
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 the same method
Number of node comparisons174
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements18
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)30.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    8
    output.write("Content-Disposition: form-data; name=\"".getBytes(HTTP_ENCODING));
    27
    output.write("Content-Disposition: form-data; name=\"".getBytes(HTTP_ENCODING));
    9
    output.write(titleField.getBytes(HTTP_ENCODING));
    9
    output.write(titleField.getBytes(HTTP_ENCODING));
    28
    output.write(descriptionField.getBytes(HTTP_ENCODING));
    Differences
    Expression1Expression2Difference
    titleFielddescriptionFieldVARIABLE_NAME_MISMATCH
    28
    output.write(descriptionField.getBytes(HTTP_ENCODING));
    10
    output.write("\"".getBytes(HTTP_ENCODING));
    29
    output.write("\"".getBytes(HTTP_ENCODING));
    11
    output.write(CRLF);
    30
    output.write(CRLF);
    12
    output.write("Content-Type: ".getBytes(HTTP_ENCODING));
    31
    output.write("Content-Type: ".getBytes(HTTP_ENCODING));
    13
    output.write(mimeType.getBytes(HTTP_ENCODING));
    32
    output.write(mimeType.getBytes(HTTP_ENCODING));
    14
    output.write("; charset=".getBytes(HTTP_ENCODING));
    33
    output.write("; charset=".getBytes(HTTP_ENCODING));
    15
    output.write((contentEncoding == null ? PostWriter.ENCODING : contentEncoding).getBytes(HTTP_ENCODING));
    34
    output.write((contentEncoding == null ? PostWriter.ENCODING : contentEncoding).getBytes(HTTP_ENCODING));
    16
    output.write(CRLF);
    30
    output.write(CRLF);
    17
    output.write("Content-Transfer-Encoding: 8bit".getBytes(HTTP_ENCODING));
    36
    output.write("Content-Transfer-Encoding: 8bit".getBytes(HTTP_ENCODING));
    18
    output.write(CRLF);
    30
    output.write(CRLF);
    19
    output.write(CRLF);
    30
    output.write(CRLF);
    20
    if (contentEncoding != null)
    39
    if (contentEncoding != null)
    21
    output.write(titleValue.getBytes(contentEncoding));
    21
    output.write(titleValue.getBytes(contentEncoding));
    40
    output.write(descriptionValue.getBytes(contentEncoding));
    Differences
    Expression1Expression2Difference
    titleValuedescriptionValueVARIABLE_NAME_MISMATCH
    40
    output.write(descriptionValue.getBytes(contentEncoding));
    else
    else
    22
    output.write(titleValue.getBytes());
    22
    output.write(titleValue.getBytes());
    41
    output.write(descriptionValue.getBytes());
    Differences
    Expression1Expression2Difference
    titleValuedescriptionValueVARIABLE_NAME_MISMATCH
    41
    output.write(descriptionValue.getBytes());
    23
    output.write(CRLF);
    30
    output.write(CRLF);
                                                  
    35
    output.write(CRLF);
    Preondition Violations
    Unmatched statement output.write(CRLF); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    35
    output.write(CRLF);
                                                  
    37
    output.write(CRLF);
    Preondition Violations
    Unmatched statement output.write(CRLF); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    37
    output.write(CRLF);
                                                  
    38
    output.write(CRLF);
                                                  
    42
    output.write(CRLF);
    Preondition Violations
    Unmatched statement output.write(CRLF); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    42
    output.write(CRLF);
    24
    output.write(DASH_DASH);
    43
    output.write(DASH_DASH);
    25
    output.write(boundaryString.getBytes(HTTP_ENCODING));
    44
    output.write(boundaryString.getBytes(HTTP_ENCODING));
    Precondition Violations (3)
    Row Violation
    1Unmatched statement output.write(CRLF); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement output.write(CRLF); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement output.write(CRLF); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted