java.util.Locale can represent language and country codes using 2 letters or 3 letters codes. Conversions from 2 to 3 letters codes are performed by the Locale.getISO3Language() and Locale.getISO3Country() methods.
When marshalling an ISO 19139 document, Apache SIS 0.3 uses the 3 letters variant in both cases. However this cause SIS to be unable to unmarshal its own documents, because the java.util.Locale does not recognize 3 letters country codes. Example:
Note that this behaviour is consistent with java.util.Locale javadoc. Looking at what OGC/ISO does on schemas.opengis.net, we can see that they use:
- 3 letters codes for languages
- 2 letters code for countries
We should align Apache SIS 0.4 on the same practice. This would allow SIS to unmarshal its own documents. However this would not solve the issue when reading a document from an other producer using the 3 letters country codes. For now we hope that those cases are rare...
Note that this JIRA task is about the country code only. Leaving the language codes as 3 letters codes leaves an other issue: while java.util.Locale works fine with them, we did not verified if java.util.ResourceBundle is capable to convert back to 2 letters language codes before to lookup for resources.