JMeterContext jmctx = JMeterContextService.getContext(); SampleResult prev = jmctx.getPreviousResult(); final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter(); if (prev == null || bshInterpreter == null) { log.error("BeanShell not found"); return; } JMeterVariables vars = jmctx.getVariables(); try { // Add variables for access to context and variables bshInterpreter.set("ctx", jmctx);//$NON-NLS-1$ bshInterpreter.set("vars", vars);//$NON-NLS-1$ bshInterpreter.set("prev", prev);//$NON-NLS-1$ bshInterpreter.set("data", prev.getResponseData());//$NON-NLS-1$ processFileOrScript(bshInterpreter); } catch (JMeterException e) { log.warn("Problem in BeanShell script "+e); }
final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter(); if (bshInterpreter == null) { log.error("BeanShell not found"); return; } JMeterContext jmctx = JMeterContextService.getContext(); JMeterVariables vars = jmctx.getVariables(); Sampler sam = jmctx.getCurrentSampler(); SampleResult prev = jmctx.getPreviousResult(); try { // Add variables for access to context and variables bshInterpreter.set("ctx", jmctx);//$NON-NLS-1$ bshInterpreter.set("vars", vars);//$NON-NLS-1$ bshInterpreter.set("sampler", sam);//$NON-NLS-1$ bshInterpreter.set("prev", prev);//$NON-NLS-1$ processFileOrScript(bshInterpreter); } catch (JMeterException e) { log.warn("Problem in BeanShell script "+e); }
Clone fragments detected by clone detection tool
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
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.4
Clones locationClones are in different classes having the same super class
Number of node comparisons59
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)3.2
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                              
    2
    if (bshInterpreter == null)
                                                                            
    3
    log.error("BeanShell not found");
                        
    4
    return;
    Preondition Violations
    Unmatched return;
    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;
    6
    return;
    Preondition Violations
    Unmatched 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);
    Preondition Violations
    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
    12
    bshInterpreter.set("sampler", sam);
    11
    bshInterpreter.set("prev", prev);
    13
    bshInterpreter.set("prev", prev);
    12
    bshInterpreter.set("data", prev.getResponseData());
    12
    bshInterpreter.set("data", prev.getResponseData());
    Preondition Violations
    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
                                                                                                                
    13
    processFileOrScript(bshInterpreter);
    14
    processFileOrScript(bshInterpreter);
    Precondition Violations (5)
    Row Violation
    1Unmatched return;
    2Unmatched return;
    3Unmatched 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
    4Unmatched 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
    5Clone fragment #1 returns variables prev, bshInterpreter , while Clone fragment #2 returns variables bshInterpreter, jmctx