Bug 45749 - Response Assertion with rule Substring doesn't work with a string contains characters + or (
Response Assertion with rule Substring doesn't work with a string contains ch...
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
2.3.2
PC Linux
: P2 normal (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on:
Blocks:
  Show dependency tree
 
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