File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/modifiers/BeanShellPreProcessor.java | File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/visualizers/BeanShellListener.java | |||
Method name: void process()
|
Method name: void sampleOccurred(SampleEvent)
|
|||
Number of AST nodes: 14 | Number of AST nodes: 13 | |||
1 | final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter();↵ | 1 | final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter();↵ | |
2 | if (bshInterpreter == null) {↵ | 2 | if (bshInterpreter == null) {↵ | |
3 | log.error("BeanShell not found");↵ | 3 | log.error("BeanShell not found");↵ | |
4 | return;↵ | 4 | return;↵ | |
5 | }↵ | 5 | }↵ | |
6 | ↵ | |||
6 | JMeterContext jmctx = JMeterContextService.getContext();↵ | 7 | JMeterContext jmctx = JMeterContextService.getContext();↵ | |
7 | JMeterVariables vars = jmctx.getVariables();↵ | 8 | JMeterVariables vars = jmctx.getVariables();↵ | |
8 | Sampler sam = jmctx.getCurrentSampler();↵ | |||
9 | SampleResult prev = jmctx.getPreviousResult();↵ | 9 | SampleResult samp=se.getResult();↵ | |
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("sampler", sam);//$NON-NLS-1$↵ | 14 | bshInterpreter.set("sampleEvent", se);//$NON-NLS-1$↵ | |
15 | bshInterpreter.set("prev", prev);//$NON-NLS-1$↵ | 15 | bshInterpreter.set("sampleResult", samp);//$NON-NLS-1$↵ | |
16 | ↵ | |||
17 | processFileOrScript(bshInterpreter);↵ | 16 | processFileOrScript(bshInterpreter);↵ | |
18 | } catch (JMeterException e) {↵ | 17 | } catch (JMeterException e) {↵ | |
19 | log.warn("Problem in BeanShell script "+e);↵ | 18 | log.warn("Problem in BeanShell script "+e);↵ | |
20 | } | 19 |
| |
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 | 84 |
Number of mapped statements | 11 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 4.3 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter(); | 1 | final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter(); | ||||||||||||||
2 | if (bshInterpreter == null) | 2 | if (bshInterpreter == null) | ||||||||||||||
3 | log.error("BeanShell not found"); | 3 | log.error("BeanShell not found"); | ||||||||||||||
4 | return; | 4 | return; | ||||||||||||||
5 | JMeterContext jmctx = JMeterContextService.getContext(); | 5 | JMeterContext jmctx = JMeterContextService.getContext(); | ||||||||||||||
6 | JMeterVariables vars = jmctx.getVariables(); | 6 | JMeterVariables vars = jmctx.getVariables(); | ||||||||||||||
| 7 | SampleResult samp = se.getResult(); | |||||||||||||||
7 | Sampler sam = jmctx.getCurrentSampler(); | | |||||||||||||||
8 | SampleResult prev = jmctx.getPreviousResult(); |
| | ||||||||||||||
9 | try | 8 | try | ||||||||||||||
10 | bshInterpreter.set("ctx", jmctx); | 9 | bshInterpreter.set("ctx", jmctx); | ||||||||||||||
11 | bshInterpreter.set("vars", vars); | 10 | bshInterpreter.set("vars", vars); | ||||||||||||||
|
| 11 | bshInterpreter.set("sampleEvent", se); | ||||||||||||||
12 | bshInterpreter.set("sampler", sam); |
| | ||||||||||||||
13 | bshInterpreter.set("prev", prev); |
| 12 | bshInterpreter.set("sampleResult", samp); | |||||||||||||
14 | processFileOrScript(bshInterpreter); | 13 | processFileOrScript(bshInterpreter); |
Row | Violation |
---|---|
1 | Unmatched statement SampleResult prev=jmctx.getPreviousResult(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement bshInterpreter.set("sampleEvent",se); 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 |
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 | Clone fragment #1 returns variables jmctx, bshInterpreter , while Clone fragment #2 returns variables bshInterpreter |