File path: /apache-jmeter-2.11/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java | File path: /apache-jmeter-2.11/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java | |||
Method name: void saveConnectionCookies(HttpMethod, URL, CookieManager)
|
Method name: void saveConnectionCookies(HttpResponse, URL, CookieManager)
|
|||
Number of AST nodes: 2 | Number of AST nodes: 2 | |||
1 | /** | 1 | private void saveConnectionCookies(HttpResponse method, URL u, CookieManager cookieManager) { | |
2 | * From the <code>HttpMethod</code>, store all the "set-cookie" key-pair | 2 | if (cookieManager != null) { | |
3 | * values in the cookieManager of the <code>UrlConfig</code>. | 3 | Header[] hdrs = method.getHeaders(HTTPConstants.HEADER_SET_COOKIE); | |
4 | * | 4 | for (Header hdr : hdrs) { | |
5 | * @param method | 5 | cookieManager.addCookieFromHeader(hdr.getValue(),u); | |
6 | * <code>HttpMethod</code> which represents the request | 6 | } | |
7 | * @param u | 7 | } | |
8 | * <code>URL</code> of the URL request | 8 | } | |
9 | * @param cookieManager | |||
10 | * the <code>CookieManager</code> containing all the cookies | |||
11 | */ | |||
12 | protected void saveConnectionCookies(HttpMethod method, URL u, CookieManager cookieManager) { | |||
13 | if (cookieManager != null) { | |||
14 | Header hdr[] = method.getResponseHeaders(HTTPConstants.HEADER_SET_COOKIE); | |||
15 | for (int i = 0; i < hdr.length; i++) { | |||
16 | cookieManager.addCookieFromHeader(hdr[i].getValue(),u); | |||
17 | } | |||
18 | } | |||
19 | } | |||
See real code fragment | See real code fragment |
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.0 |
Similarity Score | 0.375 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | for (int i = 0; i < hdr.length; i++) |
| 3 | for (Header hdr : hdrs) | |||||||||||||||
|
| 4 | cookieManager.addCookieFromHeader(hdr.getValue(), u); | ||||||||||||||||
4 | cookieManager.addCookieFromHeader(hdr[i].getValue(), u); |
| |
Row | Violation |
---|---|
1 | Type org.apache.commons.httpclient.Header[] of variable hdr does not match with type org.apache.http.Header[] of variable hdrs |
2 | Type org.apache.commons.httpclient.Header[] of variable hdr does not match with type org.apache.http.Header[] of variable hdrs |
3 | Unmatched statement cookieManager.addCookieFromHeader(hdr.getValue(),u); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement cookieManager.addCookieFromHeader(hdr[i].getValue(),u); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Clone fragment #1 returns variable i with type int , while Clone fragment #2 returns variable hdr with type org.apache.http.Header |