java.lang.ClassCastException: java.lang.String at org.mozilla.gecko.AwesomeBar.onCreateContextMenu(AwesomeBar.java:421)

VERIFIED FIXED in Firefox 11

Status

()

Firefox for Android
General
P3
critical
VERIFIED FIXED
6 years ago
5 years ago

People

(Reporter: nhirata, Assigned: wesj)

Tracking

({crash})

12 Branch
Firefox 13
ARM
Android
crash
Points:
---

Firefox Tracking Flags

(firefox11 fixed, firefox12 fixed, firefox13 verified)

Details

(Whiteboard: [native-crash], crash signature)

Attachments

(2 attachments)

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
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?
Assignee: nobody → wjohnston

Updated

6 years ago
Blocks: 719373
(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

6 years ago
This is very brittle code.  See bug 704467 for another workaround I added to protect against a similar situation.
Priority: -- → P3
(Assignee)

Comment 4

6 years ago
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.
Attachment #591253 - Flags: review?(lucasr.at.mozilla)
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"
Attachment #591253 - Flags: review?(lucasr.at.mozilla) → review+
(Assignee)

Comment 6

6 years ago
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.
(Assignee)

Comment 7

6 years ago
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.
Attachment #591253 - Flags: approval-mozilla-aurora?

Comment 8

6 years ago
Comment on attachment 591253 [details] [diff] [review]
Patch

[Triage Comment]
Mobile only - approved for Aurora.
Attachment #591253 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+

Comment 9

6 years ago
https://hg.mozilla.org/mozilla-central/rev/d9120155ac87
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 12
https://hg.mozilla.org/releases/mozilla-aurora/rev/38d3435b65f0
status-firefox11: --- → fixed

Comment 11

6 years ago
It's not fixed in Fx 11:
https://crash-stats.mozilla.com/report/list?query_search=signature&query_type=contains&reason_type=contains&range_value=4&range_unit=weeks&hang_type=any&process_type=any&signature=java.lang.ClassCastException%3A%20java.lang.String%20at%20org.mozilla.gecko.AwesomeBar.onCreateContextMenu%28AwesomeBar.java%29
Status: RESOLVED → REOPENED
Crash Signature: [@ TouchBadMemory ] → [@ TouchBadMemory ] [@ java.lang.ClassCastException: java.lang.String at org.mozilla.gecko.AwesomeBar.onCreateContextMenu(AwesomeBar.java)]
Resolution: FIXED → ---
(Assignee)

Comment 12

5 years ago
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.
Attachment #595190 - Flags: review?(mark.finkle)
Comment on attachment 595190 [details] [diff] [review]
Patch

we should remove the logging at some point. not right away.
Attachment #595190 - Flags: review?(mark.finkle) → review+
(Assignee)

Comment 14

5 years ago
Comment on attachment 595190 [details] [diff] [review]
Patch

Low risk. Mobile only. Prevents a crash.
Attachment #595190 - Flags: approval-mozilla-beta?
Attachment #595190 - Flags: approval-mozilla-aurora?
(Assignee)

Comment 15

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/82628a241e74

Updated

5 years ago
status-firefox11: fixed → affected
status-firefox12: --- → affected
Target Milestone: Firefox 12 → Firefox 13
https://hg.mozilla.org/mozilla-central/rev/82628a241e74
Status: REOPENED → RESOLVED
Last Resolved: 6 years ago5 years ago
Resolution: --- → FIXED

Updated

5 years ago
Attachment #595190 - Flags: approval-mozilla-beta?
Attachment #595190 - Flags: approval-mozilla-beta+
Attachment #595190 - Flags: approval-mozilla-aurora?
Attachment #595190 - Flags: approval-mozilla-aurora+
(Assignee)

Updated

5 years ago
Duplicate of this bug: 724652
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)
(Assignee)

Comment 19

5 years ago
http://hg.mozilla.org/releases/mozilla-aurora/rev/94a9071cf559
status-firefox12: affected → fixed
(Assignee)

Comment 20

5 years ago
http://hg.mozilla.org/releases/mozilla-beta/rev/332a8c115a74
status-firefox11: affected → fixed
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
Status: RESOLVED → VERIFIED
status-firefox13: --- → verified
You need to log in before you can comment on or make changes to this bug.