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

Throwing MissingResourceException in background thread of ApplicationStarter #835

Closed
iamcalendar opened this issue Nov 18, 2018 · 8 comments

Comments

@iamcalendar
Copy link

We have received an exception as below:

java.util.MissingResourceException: 
1.   at net.time4j.i18n.IsoTextProviderSPI.months (IsoTextProviderSPI.java)
2.   at net.time4j.i18n.IsoTextProviderSPI.months (IsoTextProviderSPI.java)
3.   at net.time4j.format.CalendarText.getMonths (CalendarText.java)
4.   at net.time4j.format.CalendarText.<init> (CalendarText.java)
5.   at net.time4j.format.CalendarText.getInstance (CalendarText.java)
6.   at net.time4j.DayPeriod.loadTextForms (DayPeriod.java)
7.   at net.time4j.DayPeriod.of (DayPeriod.java)
8.   at net.time4j.DayPeriod$Extension.from (DayPeriod.java)
9.   at net.time4j.DayPeriod$Extension.getElements (DayPeriod.java)
10.   at net.time4j.format.expert.ChronoFormatter.<init> (ChronoFormatter.java)
11.   at net.time4j.format.expert.ChronoFormatter.<init> (ChronoFormatter.java)
12.   at net.time4j.format.expert.ChronoFormatter.<init> (ChronoFormatter.java)
13.   at net.time4j.format.expert.ChronoFormatter$Builder.build (ChronoFormatter.java)
14.   at net.time4j.format.expert.ChronoFormatter$Builder.build (ChronoFormatter.java)
15.   at net.time4j.format.expert.ChronoFormatter.ofPattern (ChronoFormatter.java)
16.   at net.time4j.format.expert.StyleProcessor.createFormatter (StyleProcessor.java)
17.   at net.time4j.format.expert.StyleProcessor.quickPath (StyleProcessor.java)
18.   at net.time4j.format.expert.FormatStep.quickPath (FormatStep.java)
19.   at net.time4j.format.expert.ChronoFormatter.freeze (ChronoFormatter.java)
20.   at net.time4j.format.expert.ChronoFormatter.<init> (ChronoFormatter.java)
21.   at net.time4j.format.expert.ChronoFormatter.<init> (ChronoFormatter.java)
22.   at net.time4j.format.expert.ChronoFormatter$Builder.build (ChronoFormatter.java)
23.   at net.time4j.format.expert.ChronoFormatter$Builder.build (ChronoFormatter.java)
24.   at net.time4j.format.expert.ChronoFormatter.ofMomentStyle (ChronoFormatter.java)
25.   at net.time4j.android.ApplicationStarter$1.run (ApplicationStarter.java)

We are wondering if you have any idea why this happens? The version of Time4A is 3.44.3-2018e. Please let us know if you require any further information. Thanks again for your kind help!

@MenoData
Copy link
Owner

MenoData commented Nov 19, 2018

Do you have any clue about the concrete locale? Anyway, this should not occur even for an unsupported locale.

@MenoData MenoData added the bug label Nov 19, 2018
@MenoData MenoData added this to the F5.1 milestone Nov 19, 2018
@iamcalendar
Copy link
Author

Unfortunately, locale information is not available in Google's crash report.

@MenoData
Copy link
Owner

MenoData commented Nov 20, 2018

Yes, Google does not print the error message which would undoubtedly contain the locale information (I have made the error messages of Time4J/A quite verbose to incorporate any relevant parameter values). Sure, I could simply suppress throwing the exception but I doubt that this will solve the real problem with the data behind. And it is also not necessary because the crash does only seem to affect the background thread.

@MenoData
Copy link
Owner

I have even done following test:

    IsoTextProviderSPI spi = new IsoTextProviderSPI();
    for (Locale locale : spi.getAvailableLocales()) {
        for (TextWidth tw : TextWidth.values()) {
            for (OutputContext oc : OutputContext.values()) {
                String[] arr =
                        spi.months(CalendarText.ISO_CALENDAR_TYPE, locale, tw, oc, false);
                Log.i("TIME4A", Arrays.toString(arr));
            }
        }
    }

And executed the same test for the invalid locale new Locale("xyz"). But I have not observed any MissingResourceException. With same caution, I conclude that your observation happens on a device with at least an unhealthy definition of system locale and/or bad Android data or Android classes around java.util.ResourceBundle.

I fear, as long as Google is not able to produce reasonable error messages in the crash reports, we will still sit in the dark. The missing locale information (or missing error message) is a key in solving this issue. The only idea left is to try to update all resource access code to the level of Time4J-v5.0 (replacing java.util.ResourceBundle), but this is just a shot in the blue and needs some time.

@MenoData
Copy link
Owner

MenoData commented Nov 25, 2018

I have now updated the resource loading architecture of Time4A in the hope to get a unique behaviour independent of devices. Will keep this issue open for a while - for the sake of collecting possible future crash reports.

I recommend to use the new version v4.1-2018g which has been released just now.

@MenoData
Copy link
Owner

MenoData commented Feb 7, 2020

Any news ? If there are no more crash reports then I would like to close this issue as fixed due to the new resource loading architecture.

@iamcalendar
Copy link
Author

We have temporarily unpublished our app from the play store, but we haven't seen any crashes with our existing users.

@MenoData
Copy link
Owner

Thanks for feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants