Closed Bug 1515299 Opened 6 years ago Closed 6 years ago

[glean] IllegalArgumentException: Unknown pattern character 'X'

Categories

(Toolkit :: Telemetry, defect, P1)

defect
Points:
2

Tracking

()

RESOLVED FIXED

People

(Reporter: sebastian, Assigned: travis_)

References

Details

(Whiteboard: [telemetry:mobilesdk:m3])

Attachments

(1 file)

I started to integrate glean into the reference browser. So far my only glean related code in the application object is: > Glean.initialize(this, Configuration(applicationId = packageName)) > Glean.setMetricsEnabled(BuildConfig.TELEMETRY_ENABLED && Settings.isTelemetryEnabled(this)) Running that code crashes with the following stacktrace: > E Process: org.mozilla.reference.browser.debug, PID: 8726 > E java.lang.RuntimeException: Unable to create application org.mozilla.reference.browser.BrowserApplication: > java.lang.IllegalArgumentException > : Unknown pattern character 'X' > E at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4710) > E at android.app.ActivityThread.-wrap1(ActivityThread.java) > E at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405) > E at android.os.Handler.dispatchMessage(Handler.java:102) > E at android.os.Looper.loop(Looper.java:148) > E at android.app.ActivityThread.main(ActivityThread.java:5417) > E at java.lang.reflect.Method.invoke(Native Method) > E at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) > E at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) > E Caused by: java.lang.IllegalArgumentException: Unknown pattern character 'X' > E at java.text.SimpleDateFormat.validatePatternCharacter(SimpleDateFormat.java:323) > E at java.text.SimpleDateFormat.validatePattern(SimpleDateFormat.java:312) > E at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:365) > E at mozilla.components.service.glean.ping.PingMaker.getISOTimeString(PingMaker.kt:32) > E at mozilla.components.service.glean.ping.PingMaker.<init>(PingMaker.kt:24) > E at mozilla.components.service.glean.GleanInternalAPI.initialize(Glean.kt:63) > E at org.mozilla.reference.browser.BrowserApplication.onCreate(BrowserApplication.kt:24) > E at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013) > E at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707) > E ... 8 more> Phone: Nexus 5 Android: 6.0.1
Whiteboard: [telemetry:mobilesdk:m?]
Flags: needinfo?(tlong)
I found this: [SimpleDateFormat](https://developer.android.com/reference/java/text/SimpleDateFormat) When initializing glean, we are capturing a SimpleDateFormat object using the following pattern, where the 'X' is not supported until API version 24+. I think the minimum SDK of the reference browser is set to 21. What's weird to me is that this works on the samples-glean example and it has the same minimum SDK version as the reference browser (I believe).
(In reply to Travis Long from comment #1) > I found this: > [SimpleDateFormat](https://developer.android.com/reference/java/text/ > SimpleDateFormat) > > When initializing glean, we are capturing a SimpleDateFormat object using > the following pattern, where the 'X' is not supported until API version 24+. > I think the minimum SDK of the reference browser is set to 21. What's weird > to me is that this works on the samples-glean example and it has the same > minimum SDK version as the reference browser (I believe). I was testing this on a different emulator before, when I tested it with a SDK 23 emulator I can get the crash. I'm investigating ways to get the same output without relying on the SDK 24 specific functionality now.
Flags: needinfo?(tlong)
Attached file GitHub Pull Request
I believe that this implementation should support our minimum SDK version of 21 now.
Assignee: nobody → tlong
Points: --- → 2
Priority: -- → P1
Whiteboard: [telemetry:mobilesdk:m?] → [telemetry:mobilesdk:m3]
Should be fixed now, format works for all SDK versions from min to target.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: