Fix StringUtils.lastIndexOfAny start index by codingkiddo · Pull Request #20 · apache/empire-db (original) (raw)

Summary

Fixes an off-by-one error in StringUtils.lastIndexOfAny.

The method currently starts reverse iteration from value.length(), but the last valid character index is value.length() - 1. For non-empty strings, this can cause StringIndexOutOfBoundsException when value.charAt(i) is called.

Changes

Jira

I have requested access to Apache Jira, but the account approval is still pending. I am raising this PR first because the fix is small and straightforward.

Once my Jira account is approved, I can create/link the corresponding EMPIREDB Jira issue if required.

Verification

mvn -pl empire-db -Dtest=StringUtilsTest test mvn -pl empire-db test