Skip to content

Reject vowels in SedolCheckDigit#415

Open
sahvx655-wq wants to merge 1 commit into
apache:masterfrom
sahvx655-wq:sedol-reject-vowels
Open

Reject vowels in SedolCheckDigit#415
sahvx655-wq wants to merge 1 commit into
apache:masterfrom
sahvx655-wq:sedol-reject-vowels

Conversation

@sahvx655-wq

Copy link
Copy Markdown
Contributor

SedolCheckDigit.toInt already 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 found SEDOL_CHECK_DIGIT.isValid returning true for codes such as B0AKT02 and AAAAAA0. There is no SedolValidator wrapping this routine, so SedolCheckDigit.isValid is 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.

  • Read the contribution guidelines for this project.
  • Run a successful build using the default Maven goal with mvn.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body.

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 garydgregory changed the title reject vowels in SedolCheckDigit Reject vowels in SedolCheckDigit Jul 3, 2026

@garydgregory garydgregory left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants