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: 26 | Number of AST nodes: 26 | |||
1 | final ByteArrayOutputStream output = new ByteArrayOutputStream();↵ | 1 | final ByteArrayOutputStream output = new ByteArrayOutputStream();↵ | |
2 | if(firstMultipart) {↵ | 2 | if(firstMultipart) {↵ | |
3 | output.write(DASH_DASH);↵ | 3 | output.write(DASH_DASH);↵ | |
4 | output.write(boundaryString.getBytes(httpEncoding));↵ | 4 | output.write(boundaryString.getBytes(ISO_8859_1));↵ | |
5 | output.write(CRLF);↵ | 5 | output.write(CRLF);↵ | |
6 | }↵ | 6 | }↵ | |
7 | // replace all backslash with double backslash↵ | 7 | // replace all backslash with double backslash↵ | |
8 | String filename = file.getName();↵ | 8 | String filename = file.getName();↵ | |
9 | output.write("Content-Disposition: form-data; name=\"".getBytes(httpEncoding));↵ | 9 | output.write("Content-Disposition: form-data; name=\"".getBytes(ISO_8859_1));↵ | |
10 | output.write(fileField.getBytes(httpEncoding));↵ | 10 | output.write(fileField.getBytes(ISO_8859_1));↵ | |
11 | output.write(("\"; filename=\"" + filename + "\"").getBytes(httpEncoding));↵ | 11 | output.write(("\"; filename=\"" + filename + "\"").getBytes(ISO_8859_1));↵ | |
12 | output.write(CRLF);↵ | 12 | output.write(CRLF);↵ | |
13 | output.write("Content-Type: ".getBytes(httpEncoding));↵ | 13 | output.write("Content-Type: ".getBytes(ISO_8859_1));↵ | |
14 | output.write(mimeType.getBytes(httpEncoding));↵ | 14 | output.write(mimeType.getBytes(ISO_8859_1));↵ | |
15 | output.write(CRLF);↵ | 15 | output.write(CRLF);↵ | |
16 | output.write("Content-Transfer-Encoding: binary".getBytes(httpEncoding));↵ | 16 | output.write("Content-Transfer-Encoding: binary".getBytes(ISO_8859_1));↵ | |
17 | output.write(CRLF);↵ | 17 | output.write(CRLF);↵ | |
18 | output.write(CRLF);↵ | 18 | output.write(CRLF);↵ | |
19 | output.write(fileContent);↵ | 19 | output.write(fileContent);↵ | |
20 | output.write(CRLF);↵ | 20 | output.write(CRLF);↵ | |
21 | output.write(DASH_DASH);↵ | 21 | output.write(DASH_DASH);↵ | |
22 | output.write(boundaryString.getBytes(httpEncoding));↵ | 22 | output.write(boundaryString.getBytes(ISO_8859_1));↵ | |
23 | if(lastMultipart) {↵ | 23 | if(lastMultipart) {↵ | |
24 | output.write(DASH_DASH);↵ | 24 | output.write(DASH_DASH);↵ | |
25 | }↵ | 25 | }↵ | |
26 | output.write(CRLF);↵ | 26 | output.write(CRLF);↵ | |
27 | ↵ | 27 | ↵ | |
28 | output.flush();↵ | 28 | output.flush();↵ | |
29 | output.close();↵ | 29 | output.close();↵ | |
30 | return output.toByteArray(); | 30 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 301 |
Number of mapped statements | 26 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 130.2 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | final ByteArrayOutputStream output = new ByteArrayOutputStream(); | 2 | final ByteArrayOutputStream output = new ByteArrayOutputStream(); | |||||||||||
4 | if (firstMultipart) | 3 | if (firstMultipart) | |||||||||||
5 | output.write(DASH_DASH); | 4 | output.write(DASH_DASH); | |||||||||||
6 | output.write(boundaryString.getBytes(httpEncoding)); |
| 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)); |
| 8 | output.write("Content-Disposition: form-data; name=\"".getBytes(ISO_8859_1)); | ||||||||||
10 | output.write(fileField.getBytes(httpEncoding)); |
| 9 | output.write(fileField.getBytes(ISO_8859_1)); | ||||||||||
11 | output.write(("\"; filename=\"" + filename + "\"").getBytes(httpEncoding)); |
| 10 | output.write(("\"; filename=\"" + filename + "\"").getBytes(ISO_8859_1)); | ||||||||||
12 | output.write(CRLF); | 11 | output.write(CRLF); | |||||||||||
13 | output.write("Content-Type: ".getBytes(httpEncoding)); |
| 12 | output.write("Content-Type: ".getBytes(ISO_8859_1)); | ||||||||||
14 | output.write(mimeType.getBytes(httpEncoding)); |
| 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)); |
| 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)); |
| 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(); |
Row | Violation |
---|