Bug 61054

Summary: Endless loop in JOrphanUtils#replaceAllWithRegex
Product: JMeter Reporter: Felix Schumacher <felix.schumacher>
Component: MainAssignee: JMeter issues mailing list <issues>
Severity: normal    
Priority: P2    
Version: 3.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Don't replace the matcher

Description Felix Schumacher 2017-04-29 09:40:03 UTC
When replacing a string with a string, that includes the search, it will lead to an endless loop in JOrphanUtils#replaceAllWithRegex.

A simple testcase can be constructed using a ThreadGroup containing a HTTP Sampler with a Parameter having a key "name" and a value "abc".

Now, if try a find replace with "abc" as the search and "abcabc" as the replacement, "replace all" will never come to a halt :(
Comment 1 Felix Schumacher 2017-04-29 10:06:21 UTC
Created attachment 34963 [details]
Don't replace the matcher

Instead of replacing the matcher and using replaceFirst, take appendReplacement on the one and only matcher.
Comment 2 Felix Schumacher 2017-04-29 12:21:30 UTC
Will be included in version 3.3.

Date: Sat Apr 29 12:18:36 2017
New Revision: 1793191

URL: http://svn.apache.org/viewvc?rev=1793191&view=rev
Endless loop in JOrphanUtils#replaceAllWithRegex when regex is contained in replacement

Bugzilla Id: 61054