Update the registry and accompanying tests with the **IANA 4/13/2022** update.

This update introduces the case where an IANA entry can have a preferred value, 
but that preferred value has a preferred value as well.

This causes unexpected failures in JDK tests because of how locale 
equivalencies are created.

eg: `ar-ajp` has a preferred value of `ajp` but `ajp` has a preferred value of 
`apc`

Normally, when the JDK is built, _LocaleEquivlalentMaps.java_ generates the 
following


...
singleEquivMap.put("ar-ajp", "ajp");
singleEquivMap.put("ajp", "ar-ajp");
...
multiEquivsMap.put("apj", new String[] {"apc", "ar-apc"});
multiEquivsMap.put("apc", new String[] {"ajp", "ar-apc"});
multiEquivsMap.put("ar-apc", new String[] {"apc", "ajp"});
...


When `LocaleMatcher.parse(ACCEPT_LANGUAGE)` is called with `ACCEPT_LANGUAGE` 
containing `apc` and `ajp` in that order, the following occurs:

`apc` is found, `apc` is added, all of `apc's` equivalencies are added: `ajp` 
and `ar-apc`

When parse iterates to `ajp`, it finds that it is already added to the list, 
and does not add it's equivalency `ar-ajp`.

To address this, the build process must be adjusted so that the equivalencies 
are built as 


...
multiEquivsMap.put("ajp", new String[] {"apc", "ar-ajp", "ar-apc"});
multiEquivsMap.put("apc", new String[] {"ajp", "ar-ajp", "ar-apc"});
multiEquivsMap.put("ar-ajp", new String[] {"apc", "ajp", "ar-apc"});
multiEquivsMap.put("ar-apc", new String[] {"apc", "ajp", "ar-ajp"});
...


As, if `ar-ajp` has a preferred value of `ajp`, and `ajp` has a preferred value 
of `apc`, this technically means that `ar-ajp` is equivalent to `apc` and its 
equivalencies as well. This way, when `LocaleMatcher.parse(ACCEPT_LANGUAGE)` 
iterates to `apc`, it will add all of it's equivalencies including `ar-ajp`.

-------------

Commit messages:
 - Adjust build and test to account for new case
 - ajp should follow apc
 - Fix order of langs
 - Update test with preffered value: ajp
 - Update registry

Changes: https://git.openjdk.org/jdk/pull/13501/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13501&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8306031
  Stats: 28 lines in 3 files changed: 19 ins; 0 del; 9 mod
  Patch: https://git.openjdk.org/jdk/pull/13501.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13501/head:pull/13501

PR: https://git.openjdk.org/jdk/pull/13501

Reply via email to