Bug 55328 - __escapeOroRegexpChars trims spaces
__escapeOroRegexpChars trims spaces
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
2.9
All All
: P2 minor (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2013-07-30 09:59 UTC by rom4nevg
Modified: 2013-07-30 19:42 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rom4nevg 2013-07-30 09:59:44 UTC
__escapeOroRegexpChars function, accroding to my observations during the work with jmeter and also according to jmeter's source code, trims leading and trailing whitespaces, which was a total surprise for me.

For example, if I use ${__escapeOroRegexpChars(${SOME_VARIABLE})} in a response assertion (where SOME_VARIABLE could contain _important_ leading/trailing whitespaces), this behaviour results in inexact matches, or a failed match, if I prepend or append this assertion with some text, e.g. some_text${__escapeOroRegexpChars(${SOME_VARIABLE})}.

If this behaviour is correct and is not a subject to changes, at least it could've been mentioned in the documentation (in fact, in this case I am more dissatisfied with the fact that the documentation misses this point, rather than with the behaviour itself; trimming is mentioned in the header of the "Functions reference" section http://jmeter.apache.org/usermanual/functions.html, but it regards variable names only).
Comment 1 Sebb 2013-07-30 16:06:43 UTC
Not sure why it was coded like this, but the function does trim both the value and the variable name (if provided).

I suspect only the variable name should be trimmed.
Comment 2 Philippe Mouawad 2013-07-30 16:17:07 UTC
I don't remember why I made the trim on value, anyway I think it should be fixed with a mention in changes.html.
Comment 3 Philippe Mouawad 2013-07-30 19:42:57 UTC
Date: Tue Jul 30 19:42:13 2013
New Revision: 1508589

URL: http://svn.apache.org/r1508589
Log:
Bug 55328 - __escapeOroRegexpChars trims spaces
Bugzilla Id: 55328

Modified:
    jmeter/trunk/src/functions/org/apache/jmeter/functions/EscapeOroRegexpChars.java
    jmeter/trunk/xdocs/changes.xml