Comments (5)
I can't reproduce, so I will need to dig into this deeper.
first notes:
From crash file:
"ANDROID_VERSION": "12"
"SDK_INT": 31,
"SECURITY_PATCH": "2021-10-05"
"locale": "zh_CN_#Hans"
"userSetLocale": false
java.util.MissingResourceException: Couldn't find 3-letter language code for zz
at java.util.Locale.getISO3Language(Locale.java:1742)
at com.hardbacknutter.nevertoomanybooks.utils.Languages.createLanguageMappingCache(Unknown Source:53)
at com.hardbacknutter.nevertoomanybooks.utils.Languages.getISO3FromDisplayName(Unknown Source:17)
at com.hardbacknutter.nevertoomanybooks.utils.AppLocaleImpl.getLocale(Unknown Source:42)
at com.hardbacknutter.nevertoomanybooks.settings.SettingsViewModel.init(Unknown Source:66)
java/util/Locale.java:
String lang = baseLocale.getLanguage();
String language3 = ICU.getISO3Language(lang);
if (!lang.isEmpty() && language3.isEmpty()) {
// END Android-changed: Use ICU.
throw new MissingResourceException("Couldn't find 3-letter language code for "
+ lang, "FormatData_" + toString(), "ShortLanguage");
}
so lang=="zz" comes from: baseLocale.getLanguage()
In my tests, the Locale for "zh_CN_#Hans" and the R.array.pv_ui_language values are all passing the above without a problem.
private void createLanguageMappingCache(@NonNull final Context context,
@NonNull final Locale locale) {
final SharedPreferences cacheFile = getCacheFile(context);
// just return if already done for this Locale.
if (cacheFile.getBoolean(LANG_CREATED_PREFIX + locale.getISO3Language(), false)) {
return;
}
final SharedPreferences.Editor ed = cacheFile.edit();
for (final Locale loc : Locale.getAvailableLocales()) {
ed.putString(loc.getDisplayLanguage(locale).toLowerCase(locale),
loc.getISO3Language());
}
so we're crashing in either
locale.getISO3Language()
or
loc.getISO3Language()
The "locale" is "zh_CN_#Hans" (the userLocale as coming from up the stacktrace)
So we must be crashing in the "loc"... which is coming from "Locale.getAvailableLocales()" and this is from the device OS.
from nevertoomanybooks.
This version works properly. Thanks!
from nevertoomanybooks.
it confirms the issue was in the OS as installed by the vendor. Good to know. Thanks for the feedback!
from nevertoomanybooks.
ok, I cannot be sure, but I think I can prevent a crash if my reasoning above is correct.
I'll create a "6.0.1" version for you to test with. I'll upload it later today and notify you of course.
from nevertoomanybooks.
I uploaded 6.0.1
It has protection against the MissingResourceException by doing a fallback from the iso-3 to an iso-2 code.
It's safe to install on top of the 6.0.0 and later release will install on top of this 6.0.1.
Please give this a try and let me know the results.
from nevertoomanybooks.
Related Issues (20)
- [Feature Request] Divide built-in booklist styles and custom ones apart HOT 4
- Douban.com support HOT 1
- [Feature Request] Goodreads csv compatibility HOT 7
- [Feature Request] List & grid quick toggle button HOT 2
- [Bug] Scroll bar issue HOT 1
- [Bug] English (US) issue HOT 5
- [Feature request] Edit boxes HOT 1
- [Feature Request] AFD Thalia.de as we your er for Noobs in German, de
- [Feature request] Add thalia.de as websource
- [Feature Request] Add Deutsche National Bibliothek (DNB) to websources HOT 3
- [bug] crash after barcode scan and failed lookup HOT 4
- [bug] crash when editing first published date HOT 3
- [Missing] No link for donations!
- [Whishlist] Change Amazon URL to a local one HOT 3
- [bug] Crash when editing a cover image HOT 5
- App crash HOT 2
- App Crash after pressing lend out to... HOT 4
- scan folder HOT 1
- Dates HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nevertoomanybooks.