fix: revert special handling of Indonesian locale [DHIS2-17522] (2.39) #17833
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 forin
vs.id
language tag. In #16660 and #16623 an attempt was made to work around theLocale
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 asString
in theUI_LOCALE
setting. This would cause class cast exceptions elsewhere when that value was cast toLocale
. This was and is simply the contract of the setting that its value is an instance ofLocale
. As settings have the common denominator ofSerializable
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 aLocale
instance but just using that class comes with the unwanted behaviour for thein
vsid
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.