File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/extractor/BeanShellPostProcessor.java | File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/modifiers/BeanShellPreProcessor.java | |||
Method name: void process()
|
Method name: void process()
|
|||
Number of AST nodes: 13 | Number of AST nodes: 14 | |||
1 | JMeterContext jmctx = JMeterContextService.getContext();↵ | |||
2 | SampleResult prev = jmctx.getPreviousResult();↵ | |||
3 | final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter();↵ | 1 | final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter();↵ | |
4 | if (prev == null || bshInterpreter == null) {↵ | 2 | if (bshInterpreter == null) {↵ | |
5 | log.error("BeanShell not found");↵ | 3 | log.error("BeanShell not found");↵ | |
6 | return;↵ | 4 | return;↵ | |
7 | }↵ | |||
8 | JMeterVariables vars = jmctx.getVariables↵ | 5 | }↵ | |
6 | JMeterContext jmctx = JMeterContextService.getContext();↵ | |||
7 | JMeterVariables vars = jmctx.getVariables();↵ | |||
8 | Sampler sam = jmctx.getCurrentSampler();↵ | |||
9 | ();↵ | 9 | SampleResult prev = jmctx.getPreviousResult();↵ | |
10 | try {↵ | 10 | try {↵ | |
11 | // Add variables for access to context and variables↵ | 11 | // Add variables for access to context and variables↵ | |
12 | bshInterpreter.set("ctx", jmctx);//$NON-NLS-1$↵ | 12 | bshInterpreter.set("ctx", jmctx);//$NON-NLS-1$↵ | |
13 | bshInterpreter.set("vars", vars);//$NON-NLS-1$↵ | 13 | bshInterpreter.set("vars", vars);//$NON-NLS-1$↵ | |
14 | bshInterpreter.set("prev", prev);//$NON-NLS-1$↵ | 14 | bshInterpreter.set("sampler", sam);//$NON-NLS-1$↵ | |
15 | bshInterpreter.set("data", prev.getResponseData());//$NON-NLS-1$↵ | 15 | bshInterpreter.set("prev", prev);//$NON-NLS-1$↵ | |
16 | ↵ | |||
16 | processFileOrScript(bshInterpreter);↵ | 17 | processFileOrScript(bshInterpreter);↵ | |
17 | } catch (JMeterException e) {↵ | 18 | } catch (JMeterException e) {↵ | |
18 | log.warn("Problem in BeanShell script "+e);↵ | 19 | log.warn("Problem in BeanShell script "+e);↵ | |
19 | } | 20 |
| |
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.3 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 59 |
Number of mapped statements | 9 |
Number of unmapped statements in the first code fragment | 4 |
Number of unmapped statements in the second code fragment | 5 |
Time elapsed for statement mapping (ms) | 3.6 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||
---|---|---|---|---|---|---|---|
| 2 | if (bshInterpreter == null) | |||||
| 3 | log.error("BeanShell not found"); | |||||
|
| 4 | return; | ||||
1 | JMeterContext jmctx = JMeterContextService.getContext(); | 5 | JMeterContext jmctx = JMeterContextService.getContext(); | ||||
2 | SampleResult prev = jmctx.getPreviousResult(); | 8 | SampleResult prev = jmctx.getPreviousResult(); | ||||
3 | final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter(); | 1 | final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter(); | ||||
4 | if (prev == null || bshInterpreter == null) | | |||||
5 | log.error("BeanShell not found"); | | |||||
6 | return; |
| | ||||
7 | JMeterVariables vars = jmctx.getVariables(); | 6 | JMeterVariables vars = jmctx.getVariables(); | ||||
| 7 | Sampler sam = jmctx.getCurrentSampler(); | |||||
8 | try | 9 | try | ||||
9 | bshInterpreter.set("ctx", jmctx); | 10 | bshInterpreter.set("ctx", jmctx); | ||||
10 | bshInterpreter.set("vars", vars); | 11 | bshInterpreter.set("vars", vars); | ||||
|
| 12 | bshInterpreter.set("sampler", sam); | ||||
11 | bshInterpreter.set("prev", prev); | 13 | bshInterpreter.set("prev", prev); | ||||
12 | bshInterpreter.set("data", prev.getResponseData()); |
| | ||||
13 | processFileOrScript(bshInterpreter); | 14 | processFileOrScript(bshInterpreter); |
Row | Violation |
---|---|
1 | Unmatched return; |
2 | Unmatched return; |
3 | Unmatched statement bshInterpreter.set("sampler",sam); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
4 | Unmatched statement bshInterpreter.set("data",prev.getResponseData()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
5 | Clone fragment #1 returns variables prev, bshInterpreter , while Clone fragment #2 returns variables bshInterpreter, jmctx |