[
https://issues.apache.org/jira/browse/CODEC-347?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Aryan Ganjoo closed CODEC-347.
------------------------------
Thanks, Gary. Verified f13dd50 locally, including the added cases. Closing as
fixed.
> 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
> Priority: Minor
> Fix For: 1.23.1
>
>
> 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)