Last Comment Bug 716811 - Local DB calls getAsBoolean for IS_FOLDER, schema uses integers, ClassCastException results.
: Local DB calls getAsBoolean for IS_FOLDER, schema uses integers, ClassCastExc...
Status: RESOLVED FIXED
[inbound]
:
Product: Firefox for Android
Classification: Client Software
Component: General (show other bugs)
: unspecified
: ARM Android
: -- normal (vote)
: Firefox 12
Assigned To: Richard Newman [:rnewman]
:
:
Mentors:
Depends on:
Blocks: 709289
  Show dependency treegraph
 
Reported: 2012-01-09 23:13 PST by Richard Newman [:rnewman]
Modified: 2012-01-30 03:04 PST (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
fixed
fixed
11+


Attachments
Proposed patch. v1 (1.40 KB, patch)
2012-01-09 23:41 PST, Richard Newman [:rnewman]
blassey.bugs: review+
lucasr.at.mozilla: feedback-
Details | Diff | Splinter Review

Description Richard Newman [:rnewman] 2012-01-09 23:13:08 PST
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)
Comment 1 Richard Newman [:rnewman] 2012-01-09 23:19:14 PST
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.
Comment 2 Richard Newman [:rnewman] 2012-01-09 23:41:05 PST
Created attachment 587252 [details] [diff] [review]
Proposed patch. v1

Haven't tested this yet (blocked on another bug, and it's getting late), but it looks right...!
Comment 3 Richard Newman [:rnewman] 2012-01-10 00:31:29 PST
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.
Comment 4 Ed Morley [:emorley] 2012-01-10 11:48:30 PST
https://hg.mozilla.org/mozilla-central/rev/d33ae3516305
Comment 5 Lucas Rocha (:lucasr) 2012-01-11 11:39:05 PST
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.
Comment 6 Richard Newman [:rnewman] 2012-01-11 11:51:06 PST
(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!
Comment 7 Brad Lassey [:blassey] (use needinfo?) 2012-01-27 23:36:58 PST
If this isn't going to aurora, please mark the whiteboard not-fennec-11
Comment 8 Richard Newman [:rnewman] 2012-01-27 23:53:40 PST
Lucas, did your fix get to Aurora yet?
Comment 9 Lucas Rocha (:lucasr) 2012-01-30 03:04:37 PST
This has already been fixed in Aurora:
https://hg.mozilla.org/releases/mozilla-aurora/rev/15bbd03602a4

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