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 IllegalArgumentException in background thread of ApplicationStarter #790

Closed
iamcalendar opened this issue Jun 13, 2018 · 14 comments

Comments

@iamcalendar
Copy link

We have received an exception as below:

java.lang.IllegalArgumentException:
1. at net.time4j.tz.Timezone.a (Timezone.java:253)
2. at net.time4j.tz.Timezone.a (Timezone.java:15)
3. at net.time4j.tz.Timezone.a (Timezone.java:1)
4. at net.time4j.format.expert.ChronoFormatter.access$1000 (ChronoFormatter.java)
   or                     .access$1100 (ChronoFormatter.java)
   or                     .access$700 (ChronoFormatter.java)
   or                     .addPattern (ChronoFormatter.java)
   or                     .checkConsistency (ChronoFormatter.java)
   or                     .display (ChronoFormatter.java)
   or                     .format (ChronoFormatter.java)
   or                     .format0 (ChronoFormatter.java)
   or                     .formatToBuffer (ChronoFormatter.java)
   or                     .freeze (ChronoFormatter.java)
   or                     .getChronology (ChronoFormatter.java)
   or                     .getReason (ChronoFormatter.java)
   or                     .isEqual (ChronoFormatter.java)
   or                     .ofDatePattern (ChronoFormatter.java)
   or                     .ofMomentStyle (ChronoFormatter.java)
   or                     .ofPattern (ChronoFormatter.java)
   or                     .parse (ChronoFormatter.java)
   or                     .parseElements (ChronoFormatter.java)
   or                     .print (ChronoFormatter.java)
   or                     .rfc1123DateTime (ChronoFormatter.java)
   or                     .setUp (ChronoFormatter.java)
   or                     .sub (ChronoFormatter.java)
   or                     .updateSelf (ChronoFormatter.java)
   or                     .with (ChronoFormatter.java)
   or                     .withTimezone (ChronoFormatter.java)
5. at net.time4j.format.expert.ChronoFormatter.a (ChronoFormatter.java:22)
6. at net.time4j.android.ApplicationStarter$1.run (ApplicationStarter.java:38)
7. at java.lang.Thread.run (Thread.java:784)

It sounds like the exception is thrown in background thread of net.time4j.android.ApplicationStarter class (line 153) when tries to format the current moment:

Log.i(
    TIME4A,
    ChronoFormatter.ofMomentStyle(
        style,
        style,
        sysloc,
        tzid
    ).format(SystemClock.currentMoment())
);

We are wondering if you have any idea why this happens? Please let us know if you require any further information. Thanks again for your kind help!

MenoData added a commit to MenoData/Time4A that referenced this issue Jun 14, 2018
@MenoData
Copy link
Owner

Hm, I really miss the message of the exception shown above, and I don't know or remember any place in Time4A-code where an IllegalArgumentException is produced without any detail message (that is only with the stack trace and nothing else). Such an exception is expected if anything is wrong with the time zone and would show (in its detail message) the problem time zone identifier.

Can you please check your exception handling or look for any other Time4A-related logs which might show more details?

@iamcalendar
Copy link
Author

Thanks for responding to our question. This is all we got from the play store crash report. We agree with you that the exception message is missing. If we get more info we will let you know. Thanks for your time.

@MenoData
Copy link
Owner

Maybe this link contains some helpful info how to look for the detail message.

Another link which might be useful, too:

https://stackoverflow.com/questions/48692071/google-play-store-crash-reports-incomplete-missing-most-of-the-data

@iamcalendar
Copy link
Author

Thanks again for your help. Unfortunately, the Google Play Developer Console does'nt present the detail message. As explained in this link, it is a known issue but not fixed yet. This is another complaint.

@MenoData
Copy link
Owner

The first link I had given to you states that it might be possible to see the details after having downloaded csv-files as reports from Google. How to download (have not tested it myself though) is explained in the section "Download reports from Google Cloud Storage":

https://support.google.com/googleplay/android-developer/answer/6083203?hl=en

@iamcalendar
Copy link
Author

We examined your links but we did not get more information.

The section "Download reports from Google Cloud Storage" has a link to the following page:
https://support.google.com/googleplay/android-developer/answer/6135870

In this page, the section "Crashes & ANRs" states that:

As of May 2018, you can no longer download detailed reports for crashes and ANRs.

@MenoData
Copy link
Owner

MenoData commented Jun 14, 2018

Sorry to hear this. So what can we do now? Without the detail message, there is no chance to fix or to reproduce your issue. I don't understand Google here. About practical consequences in the app:

  • Waiting for Googles solution for the serious defect of exception reports
  • It is only the prefetch thread which fails so other parts of the app might still work???
  • Something with Timezone.ofSystem().getID() might be wrong on special devices (just a feeling now)
  • You might try out the alternative Timezone.ofPlatform() using the device data in the app

Okay, I have now implemented/improved the logging, relevant part:

142                         DisplayMode style = DisplayMode.FULL; 
143                         TZID tzid = Timezone.ofSystem().getID(); 
144                         Locale sysloc = Locale.getDefault(); 
145                         Log.i(TIME4A, "System time zone at start: [" + tzid.canonical() + "]"); 
146                         Log.i(TIME4A, "System locale at start: [" + sysloc.toString() + "]"); 
147                         try { 
148                             String currentTime = 
149                                 ChronoFormatter.ofMomentStyle( 
150                                     style, 
151                                     style, 
152                                     sysloc, 
153                                     tzid 
154                                 ).format(SystemClock.currentMoment()); 
155                             Log.i(TIME4A, currentTime); 
156                         } catch (RuntimeException re) { 
157                             Log.e( 
158                                 TIME4A, 
159                                 "Error on prefetch thread with: time zone=" 
160                                     + tzid.canonical() 
161                                     + ", locale=" + sysloc + "!", 
162                                 re); 
163                             throw re; // rethrow for Google Play Store etc. 
164                         } 

Maybe this change gives a chance to a) see the exception in Google Play Store (stacktrace and maybe timestamp of exception) and b) see the log files via downloadable reports (triggered by Log.e(...)). I will soon release a new version of Time4A so you also get the fix for the HirjiAdjustment-problem. What do you think?

@iamcalendar
Copy link
Author

At the moment, we don't have a crash/exception tracker system as we don't ask users for Internet permission (in future if we add a feature that requires Internet permission then we will definitely consider adding crash/exception analytics). For now there is nothing much we can do on our side unless wait for Google solution for exception messages. We plan to not let throw an exception for this particular case (hope this helps).

Thanks for releasing new version with HirjiAdjustment-issue fix. As always, we really appreciate your time and consideration.

MenoData added a commit that referenced this issue Jun 18, 2018
@MenoData
Copy link
Owner

I have also committed a small change in both Time4J and Time4A in order to improve the handling of customized zone identifiers. If such a non-standard id is found then the code will first check if it is the id of the current system time zone before throwing an exception. Maybe your issue will completely go away with this change.

@iamcalendar
Copy link
Author

Not sure if this helps but we received again the same crash twice. We have got the crash only on Android 8.0 devices. We guess there is a problem with this version of Android.

@MenoData
Copy link
Owner

MenoData commented Jul 4, 2018

Now I have released Time4A-v3.44-2018e which might let your issue go away.

@MenoData
Copy link
Owner

The referenced issue given by @fnlctrl also indicates that this issue is solved.

@MenoData
Copy link
Owner

Please use v3.44.1-2018e (or later) with an important fix for a crash in determining the system timezone.

@MenoData
Copy link
Owner

Sorry, my previous comment is already outdated. Please use the new bugfix release v3.44.2-2018e.

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