Bug 65259 - JMESPathExtractor Attribute Match No. Required
Summary: JMESPathExtractor Attribute Match No. Required
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 5.4.1
Hardware: PC All
: P2 minor (vote)
Target Milestone: JMETER_5.5
Assignee: JMeter issues mailing list
Keywords: FixedInTrunk
Depends on:
Reported: 2021-04-22 09:31 UTC by Dietmar Berchtold
Modified: 2021-04-27 08:55 UTC (History)
0 users

JMX to reproduce error (4.69 KB, application/xml)
2021-04-22 09:31 UTC, Dietmar Berchtold
Screenshot showing missing value (226.90 KB, image/png)
2021-04-22 09:36 UTC, Dietmar Berchtold

Note You need to log in before you can comment on or make changes to this bug.
Description Dietmar Berchtold 2021-04-22 09:31:50 UTC
Created attachment 37821 [details]
JMX to reproduce error

According to the documentation https://jmeter.apache.org/usermanual/component_reference.html#JSON_JMESPath_Extractor "Match No." is not required. But if no value is given an exception occures.

Steps to reproduce:
- run attached JMX file ("Match No." is empty for JMESPathExtractor )
- found: no value is exptracted, Error log is written

Solution 1: update documentation and mark as Required
Solution 2: use 0 as default value as in "JSON Extractor"

found log entry:
ERROR o.a.j.t.JMeterThread: Error while processing sampler: 'jp@gc - Dummy Sampler'.
java.lang.NumberFormatException: For input string: ""
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:68) ~[?:?]
	at java.lang.Integer.parseInt(Integer.java:662) ~[?:?]
	at java.lang.Integer.parseInt(Integer.java:770) ~[?:?]
	at org.apache.jmeter.extractor.json.jmespath.JMESPathExtractor.process(JMESPathExtractor.java:66) ~[ApacheJMeter_components.jar:5.4.1]
	at org.apache.jmeter.threads.JMeterThread.runPostProcessors(JMeterThread.java:955) ~[ApacheJMeter_core.jar:?]
	at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:573) ~[ApacheJMeter_core.jar:?]
	at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) [ApacheJMeter_core.jar:?]
	at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) [ApacheJMeter_core.jar:?]
	at java.lang.Thread.run(Thread.java:832) [?:?]
Comment 1 Dietmar Berchtold 2021-04-22 09:36:00 UTC
Created attachment 37822 [details]
Screenshot showing missing value
Comment 2 Felix Schumacher 2021-04-24 10:59:15 UTC
Thanks for the report. I chose to take route 2 and use "0" as the default.

Would you be able to test the next nightly or trunk build?

commit b5a3c9113e0ca084b749afdd55a526a285272ae7
AuthorDate: Sat Apr 24 11:45:56 2021 +0200

    JMESPathExtractor Attribute Match No. Required
    Bugzilla Id: 65259
 .../jmeter/extractor/json/jmespath/JMESPathExtractor.java    |  7 ++++++-
 .../extractor/json/jmespath/TestJMESPathExtractor.java       | 12 ++++++++++++
 xdocs/changes.xml                                            |  1 +
 3 files changed, 19 insertions(+), 1 deletion(-)
Comment 3 Dietmar Berchtold 2021-04-27 08:55:32 UTC
Thanks for solving the issue. 
I hopped you will choose door 2 and use "0" as default :)

I checked using build https://ci-builds.apache.org/job/JMeter/job/JMeter-trunk/254/ and can confirm issue is solved.