Aryan Ganjoo created CODEC-347:
----------------------------------

             Summary: MatchRatingApproachEncoder.isEncodeEquals throws when 
cleaning removes all characters
                 Key: CODEC-347
                 URL: https://issues.apache.org/jira/browse/CODEC-347
             Project: Commons Codec
          Issue Type: Bug
            Reporter: Aryan Ganjoo


MatchRatingApproachEncoder.isEncodeEquals(String, String) accepts nonempty 
input such as "--" but cleanName() removes every character. The subsequent 
removeVowels() calls substring(0, 1) on the empty string and throws 
StringIndexOutOfBoundsException. This is through the public comparison API, 
rather than a package-private helper.

Reproduction (current master):
{code:java}
new MatchRatingApproachEncoder().isEncodeEquals("--", "Smith");
{code}

Expected: false, as there is no usable name to compare (consistent with 
encode(String) returning an empty string after cleaning). Actual: 
StringIndexOutOfBoundsException. The same occurs with punctuation-only and 
multi-space input.

A local regression covering both argument positions and several cleaned-empty 
inputs fails on the original source and passes with an early false return 
immediately after cleanName(). Focused MatchRatingApproachEncoder tests: 99 
passed; full local mvn test: 19,921 tests, 21 skipped. No public patch has been 
submitted yet.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to