[bisq-network/bisq] Fix unhandled exception when locale specifies unknown country/region code. (PR #6029)

jmacxx notifications at github.com
Sat Feb 5 18:51:54 CET 2022


In some cases an unknown country code is obtained from the locale.  According to the [documentation](https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html), country code is "ISO 3166 alpha-2 country code or UN M.49 numeric-3 area code" (e.g. `419` = `Spanish in Latin America and the Caribbean`).  Bisq uses the country code to choose the "Default Currency" setting for new users, but if a region is specified instead, we cannot determine the currency automatically.  

- PRE: If the country code was unknown we would get an exception resulting in a blank screen and no app start up.  
- POST: Locale setting will be logged at startup.
- POST: If the country code is unknown the default currency will fallback to USD and startup will continue normally.
- Language preference will still come from the locale setting.

Fixes #5877 
Ref: https://github.com/bisq-network/bisq/issues/1204


---

Example:


    INFO  b.core.locale.GlobalSettings: Locale info: es_419

    WARN  bisq.core.user.Preferences: Could not determine currency for country 419 [java.lang.IllegalArgumentException] 


You can view, comment on, or merge this pull request online at:

  https://github.com/bisq-network/bisq/pull/6029

-- Commit Summary --

  * Fix NPE when locale specifies unknown country code.

-- File Changes --

    M core/src/main/java/bisq/core/locale/GlobalSettings.java (4)
    M core/src/main/java/bisq/core/user/Preferences.java (9)

-- Patch Links --

https://github.com/bisq-network/bisq/pull/6029.patch
https://github.com/bisq-network/bisq/pull/6029.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/6029
You are receiving this because you are subscribed to this thread.

Message ID: <bisq-network/bisq/pull/6029 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20220205/58efc61f/attachment.htm>


More information about the bisq-github mailing list