You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Aryan Ganjoo (Jira)" <ji...@apache.org> on 2026/10/17 20:44:00 UTC

[jira] [Updated] (VALIDATOR-510) IBANValidator.setValidator removes unrelated aliases when changing a secondary country code

     [ https://issues.apache.org/jira/browse/VALIDATOR-510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aryan Ganjoo updated VALIDATOR-510:
-----------------------------------
    Description: 
On current Commons Validator master, IBANValidator.setValidator treats a secondary country code as though it were the primary code of the previous validator. Replacing AX (an FI alias) with its own validator installs AX and then immediately deletes it. Removing GF (an FR alias) also removes GP and other FR aliases even though FR is still installed.

Reproduction: create a new IBANValidator and call setValidator with a new Validator for AX, length 18, and a pattern matching AX followed by 16 digits. Then hasValidator("AX") is false. In a separate instance, call setValidator("GF", -1, null); hasValidator("GP") becomes false. These unrelated aliases should remain valid under the documented same-country-code replacement behavior.

A minimal local correction only clears secondary entries when replacing/removing the previous validator under its primary code, and only while each alias still maps to that previous validator. A standalone reproduction failed on the original source and passed with the patch. On the patched candidate, IBANValidatorTest passed 435 cases and the Maven test suite passed 3,197 tests with 3 skipped on JDK 17. No hosted CI or maintainer review yet.

AI Assistance used.

  was:
On current Commons Validator master, IBANValidator.setValidator treats a secondary country code as though it were the primary code of the previous validator. Replacing AX (an FI alias) with its own validator installs AX and then immediately deletes it. Removing GF (an FR alias) also removes GP and other FR aliases even though FR is still installed.

Reproduction: create a new IBANValidator, call setValidator(new IBANValidator.Validator("AX", 18, "AX\d{16}")), then check hasValidator("AX"): it is false. In a separate instance, call setValidator("GF", -1, null), then check hasValidator("GP"): it is false. Both should remain independently valid under the documented same-country-code replacement behavior.

A minimal local correction only clears secondary entries when replacing/removing the previous validator under its primary code, and only while each alias still maps to that previous validator. A standalone reproduction failed on the original source and passed with the patch. On the patched candidate, IBANValidatorTest passed 435 cases and the Maven test suite passed 3,197 tests with 3 skipped on JDK 17. No hosted CI or maintainer review yet.

AI Assistance used.


> IBANValidator.setValidator removes unrelated aliases when changing a secondary country code
> -------------------------------------------------------------------------------------------
>
>                 Key: VALIDATOR-510
>                 URL: https://issues.apache.org/jira/browse/VALIDATOR-510
>             Project: Commons Validator
>          Issue Type: Bug
>            Reporter: Aryan Ganjoo
>            Priority: Minor
>
> On current Commons Validator master, IBANValidator.setValidator treats a secondary country code as though it were the primary code of the previous validator. Replacing AX (an FI alias) with its own validator installs AX and then immediately deletes it. Removing GF (an FR alias) also removes GP and other FR aliases even though FR is still installed.
> Reproduction: create a new IBANValidator and call setValidator with a new Validator for AX, length 18, and a pattern matching AX followed by 16 digits. Then hasValidator("AX") is false. In a separate instance, call setValidator("GF", -1, null); hasValidator("GP") becomes false. These unrelated aliases should remain valid under the documented same-country-code replacement behavior.
> A minimal local correction only clears secondary entries when replacing/removing the previous validator under its primary code, and only while each alias still maps to that previous validator. A standalone reproduction failed on the original source and passed with the patch. On the patched candidate, IBANValidatorTest passed 435 cases and the Maven test suite passed 3,197 tests with 3 skipped on JDK 17. No hosted CI or maintainer review yet.
> AI Assistance used.



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