Bug 45749 - Response Assertion with rule Substring doesn't work with a string contains characters + or (
Summary: Response Assertion with rule Substring doesn't work with a string contains ch...
Status: RESOLVED FIXED
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.3.2
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-05 05:02 UTC by Milamber
Modified: 2008-09-05 06:12 UTC (History)
1 user (show)



Attachments
Patch to correcte the assertion substring with String contains regexp operators (2.22 KB, patch)
2008-09-05 05:07 UTC, Milamber
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Milamber 2008-09-05 05:02:07 UTC
Response Assertion with rule Substring doesn't work with a string contains characters + or (

If the (http) response send :
<str name="parsedquery">+DisjunctionMaxQuery((text_fr:"a b" | title_fr:"a b")~0.01)</str>

And use a assertion results with rules "Substring", we have :

=> Assertion failure message : Bad test configuration
org.apache.oro.text.MalformedCachePatternException: Invalid
expression: +DisjunctionMaxQuery((
?+* follows nothing in expression
Comment 1 Milamber 2008-09-05 05:07:04 UTC
Created attachment 22527 [details]
Patch to correcte the assertion substring with String contains regexp operators
Comment 2 Milamber 2008-09-05 05:16:36 UTC
This error because in ResponseAssertion.java (components) in method evaluateResponse(), this instruction :

Pattern pattern = JMeterUtils.getPatternCache().getPattern(stringPattern, Perl5Compiler.READ_ONLY_MASK);

is always execute even in a substring rule.
1/ thus if the stringPattern contains a false regexp expression, the error are detected
2/ and it's not necessary to execute this instruction for a substring rule

solve : only execute this instruction for the rules : "contains" and "matches"

Comment 3 Sebb 2008-09-05 06:12:48 UTC
Thanks for the well-written report and patch.

Patch (and test case) added to SVN in

URL: http://svn.apache.org/viewvc?rev=692436&view=rev
Log:
Bug 45749 - Response Assertion does not work with a substring that is not a valid RE

Comment 4 The ASF infrastructure team 2022-09-24 20:37:42 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2150