Uploaded image for project: 'Commons Text'
  1. Commons Text
  2. TEXT-232

WordUtils.containsAllWords​() may throw PatternSyntaxException

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 1.12.0
    • None

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            engelen Arnout Engelen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: