Last Comment Bug 718904 - java.lang.ClassCastException: java.lang.String at org.mozilla.gecko.AwesomeBar.onCreateContextMenu(AwesomeBar.java:421)
: java.lang.ClassCastException: java.lang.String at org.mozilla.gecko.AwesomeBa...
Status: VERIFIED FIXED
[native-crash]
: crash
Product: Firefox for Android
Classification: Client Software
Component: General (show other bugs)
: 12 Branch
: ARM Android
: P3 critical (vote)
: Firefox 13
Assigned To: Wesley Johnston (:wesj)
:
Mentors:
: 724652 (view as bug list)
Depends on:
Blocks: 719373
  Show dependency treegraph
 
Reported: 2012-01-17 17:51 PST by Naoki Hirata :nhirata (please use needinfo instead of cc)
Modified: 2012-03-01 09:27 PST (History)
8 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
fixed
fixed
verified


Attachments
Patch (1.55 KB, patch)
2012-01-24 13:42 PST, Wesley Johnston (:wesj)
lucasr.at.mozilla: review+
akeybl: approval‑mozilla‑aurora+
Details | Diff | Splinter Review
Patch (1.22 KB, patch)
2012-02-07 14:37 PST, Wesley Johnston (:wesj)
mark.finkle: review+
akeybl: approval‑mozilla‑aurora+
akeybl: approval‑mozilla‑beta+
Details | Diff | Splinter Review

Description Naoki Hirata :nhirata (please use needinfo instead of cc) 2012-01-17 17:51:51 PST
From Soccoro Reports: 
https://crash-stats.mozilla.com/report/index/ead225f7-821f-4074-83c7-b26c32120115
https://crash-stats.mozilla.com/report/index/128464cf-edb0-4bfd-b758-a64042120115

Java Crash in app notes:
java.lang.ClassCastException: java.lang.String
	at org.mozilla.gecko.AwesomeBar.onCreateContextMenu(AwesomeBar.java:421)
	at android.view.View.createContextMenu(View.java:4363)
	at com.android.internal.view.menu.ContextMenuBuilder.show(ContextMenuBuilder.java:81)
	at com.android.internal.policy.impl.PhoneWindow$DecorView.showContextMenuForChild(PhoneWindow.java:1983)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:466)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:466)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:466)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:466)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:466)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:466)

Note: Occurs on Motorola Triumph
Comment 1 Mark Finkle (:mfinkle) (use needinfo?) 2012-01-17 18:33:22 PST
No idea if we can reproduce this crash, but based on the build (2012-01-15 12.0a1)it should be this line:
http://hg.mozilla.org/mozilla-central/annotate/c98283f80ae7/mobile/android/base/AwesomeBar.java#l421

Cursor cursor = (Cursor)selectedItem;

The error would indicate that we are trying to cast selectedItem to a Cursor, but selectedItem is a String. How could that happen?
Comment 2 Lucas Rocha (:lucasr) 2012-01-23 04:16:39 PST
(In reply to Mark Finkle (:mfinkle) from comment #1)
> No idea if we can reproduce this crash, but based on the build (2012-01-15
> 12.0a1)it should be this line:
> http://hg.mozilla.org/mozilla-central/annotate/c98283f80ae7/mobile/android/
> base/AwesomeBar.java#l421
> 
> Cursor cursor = (Cursor)selectedItem;
> 
> The error would indicate that we are trying to cast selectedItem to a
> Cursor, but selectedItem is a String. How could that happen?

Weird. Both Bookmark and Top Sites ListViews are cursor-based. The only explanation I can think of is that this bug is triggered by tapping-and-holding on top of a History section header ("Today", "Yesterday", "7 days ago", etc) which is a string element.
Comment 3 Doug Turner (:dougt) 2012-01-23 10:02:00 PST
This is very brittle code.  See bug 704467 for another workaround I added to protect against a similar situation.
Comment 4 Wesley Johnston (:wesj) 2012-01-24 13:42:36 PST
Created attachment 591253 [details] [diff] [review]
Patch

This fixes A bug with tapping on the header rows in the history pane. It does not touch the code that apparently crashed here. Nor does it happen on bing maps like the comments in the crash report suggest.
Comment 5 Lucas Rocha (:lucasr) 2012-01-25 03:25:42 PST
Comment on attachment 591253 [details] [diff] [review]
Patch

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

::: mobile/android/base/AwesomeBar.java
@@ +408,5 @@
>              ExpandableListView exList = (ExpandableListView)list;
>              int childPosition = exList.getPackedPositionChild(info.packedPosition);
>              int groupPosition = exList.getPackedPositionGroup(info.packedPosition);
> +
> +            // check if long tap is on a header row

nit: "Check"
Comment 6 Wesley Johnston (:wesj) 2012-01-25 09:00:17 PST
https://hg.mozilla.org/integration/mozilla-inbound/rev/d9120155ac87

Landed on inbound. NOTE again this does NOT fix this particular bug, I was just apparently to lazy to file a follow up for it.
Comment 7 Wesley Johnston (:wesj) 2012-01-25 09:46:17 PST
Comment on attachment 591253 [details] [diff] [review]
Patch

[Approval Request Comment]
Regression caused by (bug #): bug 711905
User impact if declined: potential crashes when long tapping on headers (Today, Yesterday, etc).
Testing completed (on m-c, etc.): Landed on central Jan 25
Risk to taking this patch (and alternatives if risky): Little risk.
Comment 8 Alex Keybl [:akeybl] 2012-01-25 17:05:36 PST
Comment on attachment 591253 [details] [diff] [review]
Patch

[Triage Comment]
Mobile only - approved for Aurora.
Comment 9 Ed Morley [:emorley] 2012-01-25 18:07:42 PST
https://hg.mozilla.org/mozilla-central/rev/d9120155ac87
Comment 10 Matt Brubeck (:mbrubeck) 2012-01-26 17:35:41 PST
https://hg.mozilla.org/releases/mozilla-aurora/rev/38d3435b65f0
Comment 12 Wesley Johnston (:wesj) 2012-02-07 14:37:07 PST
Created attachment 595190 [details] [diff] [review]
Patch

I'm still not sure what causes this. I think we're best to catch it and hope that we can find a way to reproduce.
Comment 13 Mark Finkle (:mfinkle) (use needinfo?) 2012-02-07 14:39:30 PST
Comment on attachment 595190 [details] [diff] [review]
Patch

we should remove the logging at some point. not right away.
Comment 14 Wesley Johnston (:wesj) 2012-02-07 16:44:56 PST
Comment on attachment 595190 [details] [diff] [review]
Patch

Low risk. Mobile only. Prevents a crash.
Comment 16 Ed Morley [:emorley] 2012-02-08 09:01:38 PST
https://hg.mozilla.org/mozilla-central/rev/82628a241e74
Comment 17 Wesley Johnston (:wesj) 2012-02-09 13:54:23 PST
*** Bug 724652 has been marked as a duplicate of this bug. ***
Comment 18 Naoki Hirata :nhirata (please use needinfo instead of cc) 2012-02-11 20:13:34 PST
Crash occurs on build : 20120209042012 on Model: 'SAMSUNG-SGH-I997'
Not sure, maybe needs to clear data on the phone?  Waiting to see if there's another crash that reoccurs.

From Socorro:
https://crash-stats.mozilla.com/report/index/d3a96fb8-3281-4947-b880-0ed192120209

java.lang.ClassCastException: java.lang.String
	at org.mozilla.gecko.AwesomeBar.onCreateContextMenu(AwesomeBar.java:420)
	at android.view.View.createContextMenu(View.java:4420)
	at com.android.internal.view.menu.ContextMenuBuilder.show(ContextMenuBuilder.java:81)
	at com.android.internal.policy.impl.PhoneWindow$DecorView.showContextMenuForChild(PhoneWindow.java:1933)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:460)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:460)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:460)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:460)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:460)
	at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:460)
	at android.widget.AbsListView.performLongPress(AbsListView.java:2032)
	at android.widget.AbsListView.access$600(AbsListView.java:99)
	at android.widget.AbsListView$CheckForLongPress.run(AbsListView.java:1985)
	at android.os.Handler.handleCallback(Handler.java:587)
	at android.os.Handler.dispatchMessage(Handler.java:92)
	at android.os.Looper.loop(Looper.java:130)
	at org.mozilla.gecko.GeckoApp$32.run(GeckoApp.java:1777)
	at android.os.Handler.handleCallback(Handler.java:587)
	at android.os.Handler.dispatchMessage(Handler.java:92)
	at android.os.Looper.loop(Looper.java:130)
	at android.app.ActivityThread.main(ActivityThread.java:3687)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:507)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
	at dalvik.system.NativeStart.main(Native Method)
Comment 19 Wesley Johnston (:wesj) 2012-02-17 09:27:05 PST
http://hg.mozilla.org/releases/mozilla-aurora/rev/94a9071cf559
Comment 20 Wesley Johnston (:wesj) 2012-02-17 09:30:49 PST
http://hg.mozilla.org/releases/mozilla-beta/rev/332a8c115a74
Comment 21 Cristian Nicolae (:xti) 2012-03-01 09:27:53 PST
This crash doesn't occur on the latest Nightly build. Closing bug as:

Verified fixed on:

Firefox 13.0a1 (2012-03-01)
20120301031135
http://hg.mozilla.org/mozilla-central/rev/1c3b291d0830

--
Device: Samsung Galaxy S2
OS: Android 2.3.4

Note You need to log in before you can comment on or make changes to this bug.