File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/sampler/PostWriter.java | File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java | |||
Method name: void setHeaders(URLConnection, HTTPSampler)
|
Method name: String sendPostData(PostMethod)
|
|||
Number of AST nodes: 5 | Number of AST nodes: 5 | |||
1 | HTTPFileArg file = files[0];↵ | 1 | HTTPFileArg file = files[0];↵ | |
2 | if(!hasContentTypeHeader) {↵ | 2 | if(!hasContentTypeHeader) {↵ | |
3 | // Allow the mimetype of the file to control the content type↵ | 3 | // Allow the mimetype of the file to control the content type↵ | |
4 | if(file.getMimeType() != null && file.getMimeType().length() > 0) {↵ | 4 | if(file.getMimeType() != null && file.getMimeType().length() > 0) {↵ | |
5 | connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE, file.getMimeType());↵ | 5 | post.setRequestHeader(HEADER_CONTENT_TYPE, file.getMimeType());↵ | |
6 | }↵ | 6 | }↵ | |
7 | else {↵ | 7 | else {↵ | |
8 | connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED);↵ | 8 | post.setRequestHeader(HEADER_CONTENT_TYPE, APPLICATION_X_WWW_FORM_URLENCODED);↵ | |
9 | }↵ | 9 | }↵ | |
10 | } | 10 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.5 |
Clones location | Clones are in different classes |
Number of node comparisons | 12 |
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 1.5 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||
---|---|---|---|---|---|---|---|
45 | HTTPFileArg file = files[0]; | 44 | HTTPFileArg file = files[0]; | ||||
46 | if (!hasContentTypeHeader) | 45 | if (!hasContentTypeHeader) | ||||
47 | if (file.getMimeType() != null && file.getMimeType().length() > 0) | 46 | if (file.getMimeType() != null && file.getMimeType().length() > 0) | ||||
|
| 47 | post.setRequestHeader(HEADER_CONTENT_TYPE, file.getMimeType()); | ||||
48 | connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE, file.getMimeType()); |
| | ||||
else | | ||||||
| 48 | post.setRequestHeader(HEADER_CONTENT_TYPE, APPLICATION_X_WWW_FORM_URLENCODED); | |||||
49 | connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED); | |
Row | Violation |
---|---|
1 | Unmatched statement post.setRequestHeader(HEADER_CONTENT_TYPE,file.getMimeType()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched statement connection.setRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE,file.getMimeType()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |