Closed Bug 1202154 Opened 9 years ago Closed 9 years ago

Switchboard does not catch Locale related exceptions

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(firefox43 fixed)

RESOLVED FIXED
Firefox 43
Tracking Status
firefox43 --- fixed

People

(Reporter: mfinkle, Assigned: mfinkle)

Details

Crash Data

Attachments

(1 file)

Both Locale.getISO3Language and Locale.getISO3Country can throw MissingResourceException exceptions. I see a few in crash-stats already.
Consider using o.m.g.Locales.getLanguageTag() or friends instead, if we're forking the client codebase.
This patch wraps the calls and falls back to "unknown" in cases of exceptions.
Assignee: nobody → mark.finkle
Attachment #8657492 - Flags: review?(nalexander)
Crash Signature: [@ java.util.MissingResourceException: No 3-letter language code for locale: zz_ZZ at java.util.Locale.getISO3Language(Locale.java) ] [@ java.util.MissingResourceException: No 3-letter country code for locale: ja_JA at java.util.Locale.getISO3Country(Loc…
Attachment #8657492 - Attachment is patch: true
(In reply to Richard Newman [:rnewman] from comment #1)
> Consider using o.m.g.Locales.getLanguageTag() or friends instead, if we're
> forking the client codebase.

I wouldn't use it directly yet, but we could consider using the basics. It would change the code sent to the server, but we are not using that yet for anything. If we decide to use Switchboard for iOS, it would be nice to have consistent language and country codes being sent up from each platform.
zz_ZZ is Accented English, a developer option. Switchboard should recognize that and return a sentinel rather than just muffling; we know it's English, not Unknown. Alternatively, we could treat this as en_US.

ja_JA is just wrong; it should be ja_JP, in which case the 3-letter country code will be "JPN". This sounds like a really broken device. The crash reports say it's an iNet ADP-921, which is an el cheapo $75 9" tablet sold at Japanese grocery stores, so I bet it's a typo from the OEM when they hard-coded the firmware to Japanese….

I'm not opposed to introducing a correction step here; we'll need to do so for our strings and other reporting to work correctly anyway.
I'm late to this party, but it appears to me:

* We should specifically handle zz_ZZ, since it's an Android-ism that java.utils.getISO3* won't handle and it has a clear interpretation.

* We do need to catch some exceptions.

It's not clear that we should go all the way to replacing Switchboard's language codes with Fennec's.  It stands to reason that Switchboard Android and iOS agree right now, where-as Fennec and unmodified Switchboard iOS will not agree.
Status: NEW → ASSIGNED
Comment on attachment 8657492 [details] [diff] [review]
switchboard-locale-crashfix v0.1

Review of attachment 8657492 [details] [diff] [review]:
-----------------------------------------------------------------

I'm fine with this as is -- we're unlikely to see "unknown" frequently in the wild.  I'd prefer to catch zz_ZZ, for the reasons mentioned in my comment.  I think changing the code entirely is follow-up.
Attachment #8657492 - Flags: review?(nalexander) → review+
(In reply to Richard Newman [:rnewman] from comment #4)
> zz_ZZ is Accented English, a developer option. Switchboard should recognize
> that and return a sentinel rather than just muffling; we know it's English,
> not Unknown. Alternatively, we could treat this as en_US.

(In reply to Nick Alexander :nalexander from comment #5)

> * We should specifically handle zz_ZZ, since it's an Android-ism that
> java.utils.getISO3* won't handle and it has a clear interpretation.

I also see mention of en_XA (adds glyphs & inflates length) and ar_XB (reverses every string and sets the locale to right-to-left). Given that these are developer options and not production options, I don't want to add anything just yet.
https://hg.mozilla.org/mozilla-central/rev/da7ee978ac06
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 43
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: