Bug 60438

Summary: Clear old variables before extracting new ones in JSON Processor
Product: JMeter Reporter: Felix Schumacher <felix.schumacher>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.1   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Felix Schumacher 2016-12-01 19:38:47 UTC
As reported in PR 235 on github, JSON Processor leaves old variables when extracting new ones. That can lead to weird behaviour in ForEach loops.

This bug can be triggered for example by the following flow:

 1. JSON Processor is configured to extract all members of an array and finds the specified path in the result. It will fill the vars REF, REF_matchNr and REF_Xs
 2. JSON Processor is still configured to extract all members, but gets an empty result to extract from. It will remove REF, but REF_matchNr and REF_Xs will be left untouched.

Another bug, that was uncovered while working on this one, was that the Processor wrongly filled REF_matchNr with "1" without filling REF_1 when configured to extract a random match (match number = "0"). The correct behaviour here seems to be to not fill REF_matchNr at all.
Comment 1 Felix Schumacher 2016-12-01 19:39:14 UTC
Date: Thu Dec  1 18:39:36 2016
New Revision: 1772247

URL: http://svn.apache.org/viewvc?rev=1772247&view=rev
Log:
Clear leftover variables before extracting new ones in JSON Extractor.
Based on a patch by Qi Chen (qi.chensh at ele.me)

This closes #235 on github.

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/extractor/json/jsonpath/JSONPostProcessor.java
    jmeter/trunk/test/src/org/apache/jmeter/extractor/TestJSONPostProcessor.java
    jmeter/trunk/xdocs/changes.xml