Bug 65259

Summary: JMESPathExtractor Attribute Match No. Required
Product: JMeter Reporter: Dietmar Berchtold <dietmar.berchtold>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: minor Keywords: FixedInTrunk
Priority: P2    
Version: 5.4.1   
Target Milestone: JMETER_5.5   
Hardware: PC   
OS: All   
Attachments: JMX to reproduce error
Screenshot showing missing value

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.