Bug 61054 - Endless loop in JOrphanUtils#replaceAllWithRegex
Summary: Endless loop in JOrphanUtils#replaceAllWithRegex
Alias: None
Product: JMeter - Now in Github
Classification: Unclassified
Component: Main (show other bugs)
Version: 3.2
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
Depends on:
Reported: 2017-04-29 09:40 UTC by Felix Schumacher
Modified: 2017-04-29 12:21 UTC (History)
0 users

Don't replace the matcher (1.49 KB, patch)
2017-04-29 10:06 UTC, Felix Schumacher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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

Comment 3 The ASF infrastructure team 2022-09-24 20:38:08 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/4380