TakahikoKawasaki/nv-i18n

Seems to have an issue with CountryCode.AN ("Netherlands Antilles")

amarocco opened this issue · 8 comments

Hello,

Looking at the countryCode I saw that for the value AN("Netherlands Antilles") alpha3Code is 4 char length so getByCode will never return it as segregation is done on code length (2,3 and 9).
Furthermore on wikipedia alpha3code allocated to AN is ANT (Transitional reservations)
see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3

A runtime check, in the CountryCode constructor, that the alpha3 code is exactly 3 characters long would have caught this nicely.

Looking further it seems that all Assignment.TRANSITIONALLY_RESERVED are in the same situation

  • AN (ANHH => ANT)
  • BU (BUMM => BUR)
  • CS (CSXX => SCG)
  • NT (NTHH => NTZ)
  • TP (TPTL => TMP)
  • YU (YUCS => YUG)
  • ZR (ZRCD => ZAR)

Finland is indicated as Assignment.TRANSITIONALLY_RESERVED

Thank you for your pointing out the issue. Let me check it...

Hmm... I cannot remember why I wrote ANHH instead of ANT. It seems all the four-letter codes should be changed to their corresponding 3-letter codes. Is my understanding correct?

I fixed the implementation and released a new version, 1.16. The changes made are as follows:

1.16 (2015-07-25)

  • Changed the value returned from CountryCode.getByAlpha3() of some
    CountryCode entries that had previously returned a 4-letter string
    (Issue 28).
    To be concrete, the changes made are as follows. For backward
    compatibility, CountryCode.getByCode(String, boolean) and its
    variants accept the old 4-letter values listed here.
CountryCode Old Value New Value
CountryCode.AN ANHH ANT
CountryCode.BU BUMM BUR
CountryCode.CS CSXX SCG
CountryCode.NT NTHH NTZ
CountryCode.TP TPTL TMP
CountryCode.YU YUCS YUG
CountryCode.ZR ZRCD ZAR
  • Changed the implementation of CountryCode.getByCode(String, boolean)
    to return CountryCode.FI instead of CountryCode.SF when "FIN"
    is given.

Thanks for the quick return!
To be consistent as SF and FI share the same have numeric value
I think getByCode(Int) should be changed too isn't it?

Oh, you are right. I'll fix it soon.

I fixed the implementation and released a new version, 1.17. The changes made are as follows:

1.17 (2015-07-25)

  • Changed the numeric code of CountryCode.FX from -1 to 249.
  • Changed the numeric code of CountryCode.SU from -1 to 810.
  • Changed the numeric code of CountryCode.TP from 0 to 626.
  • Changed the numeric code of CountryCode.UK from -1 to 826.
  • Changed the numeric code of CountryCode.ZR from 0 to 180.
  • Changed the behavior of CountryCode.getByCode(int) for shared
    numeric codes. See its JavaDoc for details.