File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/control/HttpMirrorThread.java | File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java | |||
Method name: String getRequestHeaderValue(String, String)
|
Method name: String getSentRequestHeaderValue(String, String)
|
|||
Number of AST nodes: 6 | Number of AST nodes: 6 | |||
1 | Perl5Matcher localMatcher = JMeterUtils.getMatcher();↵ | 1 | Perl5Matcher localMatcher = JMeterUtils.getMatcher();↵ | |
2 | // We use multi-line mask so can prefix the line with ^↵ | |||
3 | // also match \w+ to catch Transfer-Encoding: chunked↵ | |||
4 | // TODO: may need to be extended to allow for other header values with non-word contents↵ | |||
5 | String expression = "^" + headerName + ":\\s+(\\w+)"; // $NON-NLS-1$ $NON-NLS-2$ ↵ | 2 | String expression = ".*" + headerName + ": (\\d*).*";↵ | |
6 | Pattern pattern = JMeterUtils.getPattern(expression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK);↵ | 3 | Pattern pattern = JMeterUtils.getPattern(expression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.SINGLELINE_MASK);↵ | |
7 | if(localMatcher.contains(requestHeaders, pattern)) {↵ | 4 | if(localMatcher.matches(requestHeaders, pattern)) {↵ | |
8 | // The value is in the first group, group 0 is the whole match↵ | 5 | // The value is in the first group, group 0 is the whole match↵ | |
9 | return localMatcher.getMatch().group(1);↵ | 6 | return localMatcher.getMatch().group(1);↵ | |
10 | }↵ | 7 | }↵ | |
11 | else {↵ | |||
12 | return null;↵ | 8 |
| |
13 | } | |||
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.2 |
Clones location | Clones are in different classes |
Number of node comparisons | 18 |
Number of mapped statements | 5 |
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) | 1.9 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Perl5Matcher localMatcher = JMeterUtils.getMatcher(); | 1 | Perl5Matcher localMatcher = JMeterUtils.getMatcher(); | ||||||||||||||
2 | String expression = "^" + headerName + ":\\s+(\\w+)"; |
| 2 | String expression = ".*" + headerName + ": (\\d*).*"; | |||||||||||||
3 | Pattern pattern = JMeterUtils.getPattern(expression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK); |
| 3 | Pattern pattern = JMeterUtils.getPattern(expression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.SINGLELINE_MASK); | |||||||||||||
4 | if (localMatcher.contains(requestHeaders, pattern)) |
| 4 | if (localMatcher.matches(requestHeaders, pattern)) | |||||||||||||
5 | return localMatcher.getMatch().group(1); | 5 | return localMatcher.getMatch().group(1); | ||||||||||||||
else | | ||||||||||||||||
6 | return null; |
| | ||||||||||||||
|
| 6 | return null; |
Row | Violation |
---|---|
1 | Expression localMatcher.contains(requestHeaders,pattern) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression localMatcher.matches(requestHeaders,pattern) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Unmatched return null; |
4 | Unmatched return null; |