ByteArrayOutputStream bos = new ByteArrayOutputStream();
put.getRequestEntity().writeRequest(bos);
bos.flush();
// We get the posted bytes as UTF-8, since java is using UTF-8
putBody.append(new String(bos.toByteArray() , "UTF-8")); // $NON-NLS-1$
bos.close();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
post.getRequestEntity().writeRequest(bos);
bos.flush();
// We get the posted bytes as UTF-8, since java is using UTF-8
postedBody.append(new String(bos.toByteArray() , "UTF-8")); // $NON-NLS-1$
bos.close();
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
|
|
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
|
Method name: String sendPutData(PutMethod)
|
|
Method name: String sendPostData(PostMethod)
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | ByteArrayOutputStream bos = new ByteArrayOutputStream();↵ | | 1 | ByteArrayOutputStream bos = new ByteArrayOutputStream();↵
|
2 | put.getRequestEntity().writeRequest(bos);↵ | | 2 | post.getRequestEntity().writeRequest(bos);↵
|
3 | bos.flush();↵ | | 3 | bos.flush();↵
|
4 | // We get the posted bytes as UTF-8, since java is using UTF-8↵ | | 4 | // We get the posted bytes as UTF-8, since java is using UTF-8↵
|
5 | putBody.append(new String(bos.toByteArray() , "UTF-8")); // $NON-NLS-1$↵ | | 5 | postedBody.append(new String(bos.toByteArray() , "UTF-8")); // $NON-NLS-1$↵
|
6 | bos.close(); | | 6 | bos.close();
|
See real code fragment |
|
See real code fragment |
Summary
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.0 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 17 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 5 |
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) | 0.0 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
34 | ByteArrayOutputStream bos = new ByteArrayOutputStream(); | | 91 | ByteArrayOutputStream bos = new ByteArrayOutputStream(); |
35 | put.getRequestEntity().writeRequest(bos); | | 92 | post.getRequestEntity().writeRequest(bos); |
36 | bos.flush(); | | 93 | bos.flush(); |
37 | putBody.append(new String(bos.toByteArray(), "UTF-8")); | | 94 | postedBody.append(new String(bos.toByteArray(), "UTF-8")); |
38 | bos.close(); | | 95 | bos.close(); |
Precondition Violations (0)
Row |
Violation |