Bug 60438 - Clear old variables before extracting new ones in JSON Processor
Summary: Clear old variables before extracting new ones in JSON Processor
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 3.1
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-01 19:38 UTC by Felix Schumacher
Modified: 2016-12-01 19:39 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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