Reject vowels in SedolCheckDigit#415
Open
sahvx655-wq wants to merge 1 commit into
Open
Conversation
SEDOL codes never contain the vowels A, E, I, O or U, but toInt only checked isAsciiAlphaNum, so a code with a vowel and a correct check digit validated. Reject vowels alongside the existing range check.
garydgregory
requested changes
Jul 3, 2026
garydgregory
left a comment
Member
There was a problem hiding this comment.
Hello @sahvx655-wq
Thank you for the PR.
- Use a parameterized test instead of a loop
- Add test fixtures that check each vowel indidivually.
TY!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SedolCheckDigit.toIntalready rejects out-of-range and non-alphanumeric characters, but it accepts vowels. The SEDOL alphabet deliberately omits A, E, I, O and U (as noted in the Wikipedia reference in the class Javadoc), so no genuine SEDOL contains one. Whilst working through these routines I generated a correct modulus-10 check digit for bodies containing vowels and foundSEDOL_CHECK_DIGIT.isValidreturning true for codes such asB0AKT02andAAAAAA0. There is noSedolValidatorwrapping this routine, soSedolCheckDigit.isValidis the only public SEDOL entry point and the over-acceptance is user visible: a string that can never be a real SEDOL passes validation purely because its check digit happens to line up.The fix rejects vowels in
toInt, next to the existing alphanumeric-range check, which is where the other per-character SEDOL rules already live, so the whole character set stays enforced in one place rather than being pushed onto callers. The added test asserts vowel-bearing codes with valid check digits are rejected while the existing consonant fixtures still validate; it fails before the change and passes after.mvn.