Details
Description
If you do say StringUtils.countMatches("x", ""), then it goes into an infinite loop.
Also sub isn't checked for null if str is null also. For instance
StringUtils.countMatches(null, null) should throw an NPE instead of 0.
To fix both problems put the following code at the start of the method:
if (sub.equals(""))
{ return 0; }Attachments
Attachments
Issue Links
- is cloned by
-
LANG-1028 CLONE - StringUtils.countMatches loops forever if substring empty
- Closed