Closed Bug 716811 Opened 13 years ago Closed 13 years ago

Local DB calls getAsBoolean for IS_FOLDER, schema uses integers, ClassCastException results.

Categories

(Firefox for Android Graveyard :: General, defect)

ARM
Android
defect
Not set
normal

Tracking

(firefox11 fixed, firefox12 fixed, fennec11+)

RESOLVED FIXED
Firefox 12
Tracking Status
firefox11 --- fixed
firefox12 --- fixed
fennec 11+ ---

People

(Reporter: rnewman, Assigned: rnewman)

References

Details

(Whiteboard: [inbound])

Attachments

(1 file)

01-09 23:09:46.828 E/ContentValues(10750): Cannot cast value for folder to a Boolean: 0 01-09 23:09:46.828 E/ContentValues(10750): java.lang.ClassCastException: java.lang.Integer 01-09 23:09:46.828 E/ContentValues(10750): at android.content.ContentValues.getAsBoolean(ContentValues.java:413) 01-09 23:09:46.828 E/ContentValues(10750): at org.mozilla.fennec_rnewman.db.BrowserProvider.insertInTransaction(BrowserProvider.java:695) 01-09 23:09:46.828 E/ContentValues(10750): at org.mozilla.fennec_rnewman.db.BrowserProvider.insert(BrowserProvider.java:662)
Looks like this is actually a Fennec bug. Pretty high priority; this blocks further testing of bookmarks sync. (Well, so does "turn on local DB support", but I'm working around that :D) lucasr, this one for you? private void createMobileBookmarksFolder(SQLiteDatabase db) { ContentValues values = new ContentValues(); values.put(Bookmarks.GUID, Bookmarks.MOBILE_FOLDER_GUID); values.put(Bookmarks.IS_FOLDER, 1); values.put(Bookmarks.POSITION, 0); and db.execSQL("CREATE TABLE " + TABLE_BOOKMARKS + "(" + Bookmarks._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + Bookmarks.TITLE + " TEXT," + Bookmarks.URL + " TEXT," + Bookmarks.IS_FOLDER + " INTEGER NOT NULL DEFAULT 0," + versus the line that fails: String url = values.getAsString(Bookmarks.URL); ContentValues imageValues = extractImageValues(values, url); Boolean isFolder = values.getAsBoolean(Bookmarks.IS_FOLDER); This should probably be Boolean isFolder = values.getAsInteger(Bookmarks.IS_FOLDER) == 1; I don't know if the getAsBoolean version works elsewhere, but apparently it doesn't on Android 2.3.4 on the Galaxy S2.
Assignee: rnewman → nobody
Status: ASSIGNED → NEW
Component: Android Sync → General
Product: Mozilla Services → Fennec Native
QA Contact: android-sync → general
Summary: Bookmarks repository layer uses integers rather than booleans → Local DB calls getAsBoolean for IS_FOLDER, schema uses integers, ClassCastException results.
Attached patch Proposed patch. v1 (deleted) — Splinter Review
Haven't tested this yet (blocked on another bug, and it's getting late), but it looks right...!
Attachment #587252 - Flags: review?(blassey.bugs)
Attachment #587252 - Flags: feedback?(lucasr.at.mozilla)
Attachment #587252 - Flags: review?(blassey.bugs) → review+
Inbound: https://hg.mozilla.org/integration/mozilla-inbound/rev/d33ae3516305 Thanks for the quick turnaround, Brad. Note to self: flag for Aurora approval when this lands.
Assignee: nobody → rnewman
Status: NEW → ASSIGNED
Whiteboard: [inbound]
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 12
Comment on attachment 587252 [details] [diff] [review] Proposed patch. v1 Review of attachment 587252 [details] [diff] [review]: ----------------------------------------------------------------- This patch causes a NullPointerException when adding bookmarks. I submitted a patch in bug 707150 to fix that (given that the patch is already in mozilla-central). I think we should skip this patch from aurora and a slightly different version of my patch in bug 707150 instead.
Attachment #587252 - Flags: feedback?(lucasr.at.mozilla) → feedback-
(In reply to Lucas Rocha (:lucasr) from comment #5) > I think we should skip this patch from aurora and a > slightly different version of my patch in bug 707150 instead. Agreed!
If this isn't going to aurora, please mark the whiteboard not-fennec-11
tracking-fennec: --- → 11+
Lucas, did your fix get to Aurora yet?
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: