File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java | File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/control/HttpMirrorThread.java | |||
Method name: int getPositionOfBody(String)
|
Method name: int getPositionOfBody(String)
|
|||
Number of AST nodes: 8 | Number of AST nodes: 8 | |||
1 | Perl5Matcher localMatcher = JMeterUtils.getMatcher();↵ | 1 | Perl5Matcher localMatcher = JMeterUtils.getMatcher();↵ | |
2 | // The headers and body are divided by a blank line↵ | 2 | // The headers and body are divided by a blank line (the \r is to allow for the CR before LF)↵ | |
3 | String regularExpression = "^.$"; ↵ | 3 | String regularExpression = "^\\r$"; // $NON-NLS-1$↵ | |
4 | Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK);↵ | 4 | Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK);↵ | |
5 | ↵ | 5 | ↵ | |
6 | PatternMatcherInput input = new PatternMatcherInput(stringToCheck);↵ | 6 | PatternMatcherInput input = new PatternMatcherInput(stringToCheck);↵ | |
7 | while(localMatcher.contains(input, pattern)) {↵ | 7 | if(localMatcher.contains(input, pattern)) {↵ | |
8 | MatchResult match = localMatcher.getMatch();↵ | 8 | MatchResult match = localMatcher.getMatch();↵ | |
9 | return match.beginOffset(0);↵ | 9 | return match.beginOffset(0);↵ | |
10 | }↵ | 10 | }↵ | |
11 | // No divider was found↵ | 11 | // No divider was found↵ | |
12 | return -1; | 12 |
| |
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.1 |
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 | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 2.3 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Perl5Matcher localMatcher = JMeterUtils.getMatcher(); | 1 | Perl5Matcher localMatcher = JMeterUtils.getMatcher(); | |||||||||||
2 | String regularExpression = "^.$"; |
| 2 | String regularExpression = "^\\r$"; | ||||||||||
3 | Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK); | 3 | Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK); | |||||||||||
4 | PatternMatcherInput input = new PatternMatcherInput(stringToCheck); | 4 | PatternMatcherInput input = new PatternMatcherInput(stringToCheck); | |||||||||||
|
| 5 | if (localMatcher.contains(input, pattern)) | |||||||||||
|
| 6 | MatchResult match = localMatcher.getMatch(); | |||||||||||
|
| 7 | return match.beginOffset(0); | |||||||||||
5 | while (localMatcher.contains(input, pattern)) |
| | |||||||||||
6 | MatchResult match = localMatcher.getMatch(); |
| | |||||||||||
7 | return match.beginOffset(0); |
| | |||||||||||
8 | return -1; | 8 | return -1; |
Row | Violation |
---|---|
1 | Unmatched statement if(localMatcher.contains(input,pattern)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement MatchResult match=localMatcher.getMatch(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched return match.beginOffset(0); |
4 | Unmatched statement while(localMatcher.contains(input,pattern)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement MatchResult match=localMatcher.getMatch(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Unmatched return match.beginOffset(0); |
7 | Clone fragment #1 returns variables localMatcher, pattern, input , while Clone fragment #2 returns variables localMatcher, pattern, input |
8 | The refactoring of the clones is infeasible, because classes org.apache.jmeter.protocol.http.sampler.TestHTTPSamplersAgainstHttpMirrorServer and org.apache.jmeter.protocol.http.control.HttpMirrorThread do not have a common superclass |