Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: revert special handling of Indonesian locale [DHIS2-17522] (2.39) #17833

Merged
merged 3 commits into from
Jun 20, 2024

Conversation

jbee
Copy link
Contributor

@jbee jbee commented Jun 19, 2024

Summary

JDK Locale has some build in conversions for language tags. These can evolve and thereby change with the JDK version. One such change presumably was causing issues for in vs. id language tag. In #16660 and #16623 an attempt was made to work around the Locale behaviour. While this worked for the code path looked at in the ticket this introduced a big issue. In order to work the locale was stored as String in the UI_LOCALE setting. This would cause class cast exceptions elsewhere when that value was cast to Locale. This was and is simply the contract of the setting that its value is an instance of Locale. As settings have the common denominator of Serializable this type issue could slip though the type checking. Also the settings service lacks validation that would make sure that the stored value is actually of the type specified with each setting key.

As we have to store the UI_LOCALE as a Locale instance but just using that class comes with the unwanted behaviour for the in vs id problem that problem simply cannot be addressed. This would require a complete revamp of large parts of the settings which s beyond the scope of the problem.

In addition to reverting the original fix this also fixes an issue found while testing in the settings controller where the content type needs to be specified explicitly to have jackson understand the target of the conversion.

@jbee jbee self-assigned this Jun 19, 2024
@jbee jbee requested a review from david-mackessy June 19, 2024 08:02
Copy link

sonarcloud bot commented Jun 19, 2024

@jbee jbee merged commit 247e8bd into dhis2:2.39 Jun 20, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants