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