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); }
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("sampleEvent", se);//$NON-NLS-1$ bshInterpreter.set("sampleResult", samp);//$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/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: 6 Number of AST nodes: 6
1
try {
1
try {
2
            // Add variables for access to context and variables
2
            // Add variables for access to context and variables
3
            bshInterpreter.set("ctx", jmctx);//$NON-NLS-1$
3
            bshInterpreter.set("ctx", jmctx);//$NON-NLS-1$
4
            bshInterpreter.set("vars", vars);//$NON-NLS-1$
4
            bshInterpreter.set("vars", vars);//$NON-NLS-1$
5
            bshInterpreter.set("sampler", sam);//$NON-NLS-1$
5
            bshInterpreter.set("sampleEvent", se);//$NON-NLS-1$
6
            bshInterpreter.set("prev", prev);//$NON-NLS-1$
6
            bshInterpreter.set("sampleResult", samp);//$NON-NLS-1$
7
            
8
            processFileOrScript(bshInterpreter);
7
            processFileOrScript(bshInterpreter);
9
        } catch (JMeterException e) {
8
        } catch (JMeterException e) {
10
            log.warn("Problem in BeanShell script "+e);
9
            log.warn("Problem in BeanShell script "+e);
11
        }
10
        }
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons36
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)13.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    9
    try
    8
    try
    10
    bshInterpreter.set("ctx", jmctx);
    9
    bshInterpreter.set("ctx", jmctx);
    11
    bshInterpreter.set("vars", vars);
    10
    bshInterpreter.set("vars", vars);
    12
    bshInterpreter.set("sampler", sam);
    12
    bshInterpreter.set("sampler", sam);
    11
    bshInterpreter.set("sampleEvent", se);
    Differences
    Expression1Expression2Difference
    "sampler""sampleEvent"LITERAL_VALUE_MISMATCH
    samseVARIABLE_NAME_MISMATCH
    org.apache.jmeter.samplers.Samplerorg.apache.jmeter.samplers.SampleEventVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.jmeter.samplers.Sampler of variable sam does not match with type org.apache.jmeter.samplers.SampleEvent of variable se
    • Make classes org.apache.jmeter.samplers.Sampler and org.apache.jmeter.samplers.SampleEvent extend a common superclass
    11
    bshInterpreter.set("sampleEvent", se);
    13
    bshInterpreter.set("prev", prev);
    13
    bshInterpreter.set("prev", prev);
    12
    bshInterpreter.set("sampleResult", samp);
    Differences
    Expression1Expression2Difference
    "prev""sampleResult"LITERAL_VALUE_MISMATCH
    prevsampVARIABLE_NAME_MISMATCH
    12
    bshInterpreter.set("sampleResult", samp);
    14
    processFileOrScript(bshInterpreter);
    13
    processFileOrScript(bshInterpreter);
    Precondition Violations (1)
    Row Violation
    1Type org.apache.jmeter.samplers.Sampler of variable sam does not match with type org.apache.jmeter.samplers.SampleEvent of variable se