You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2025/08/22 12:12:00 UTC
[jira] [Resolved] (LANG-1783) WordUtils.containsAllWords() may throw PatternSyntaxException
[ https://issues.apache.org/jira/browse/LANG-1783?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gary D. Gregory resolved LANG-1783.
-----------------------------------
Assignee: Gary D. Gregory
Resolution: Fixed
* Clone Commons Text ticket TEXT-232
* Port change from Commons Text, even though the {{WordUtils}} class is deprecated in Lang.
> WordUtils.containsAllWords() may throw PatternSyntaxException
> --------------------------------------------------------------
>
> Key: LANG-1783
> URL: https://issues.apache.org/jira/browse/LANG-1783
> Project: Commons Lang
> Issue Type: Bug
> Reporter: Arnout Engelen
> Assignee: Gary D. Gregory
> Priority: Minor
> Fix For: 3.19.0
>
>
> {{WordUtils.containsAllWords()}} checks if the String contains all words in the given array.
> Surprisingly, it interprets the words to be searched for as regular expressions, so for example searching for ")" would throw a PatternSyntaxException. Nothing in the javadoc nor the testcases suggests this is intentional.
> We could fix this by applying "{{{}Pattern.quote(){}}}" to the parameters, or by rejecting non-word characters outright.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)