diff options
author | John Reck <jreck@google.com> | 2011-12-02 15:47:49 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-12-02 15:47:49 -0800 |
commit | dd8fb0ce362b1206c208930170480a1cc9ad7251 (patch) | |
tree | 91e2d1e82c7423d5ba0d0e411ff775455f179773 | |
parent | 958e2277685fe9f82371b44623cea5d33b57c7f2 (diff) | |
parent | 31ae2cc171ed6355d958ea05501ce6e7ef0ad223 (diff) | |
download | packages_apps_Browser-dd8fb0ce362b1206c208930170480a1cc9ad7251.zip packages_apps_Browser-dd8fb0ce362b1206c208930170480a1cc9ad7251.tar.gz packages_apps_Browser-dd8fb0ce362b1206c208930170480a1cc9ad7251.tar.bz2 |
am 31ae2cc1: Switch BP1->2 upgrade to best effort
* commit '31ae2cc171ed6355d958ea05501ce6e7ef0ad223':
Switch BP1->2 upgrade to best effort
-rw-r--r-- | src/com/android/browser/provider/BrowserProvider2.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/com/android/browser/provider/BrowserProvider2.java b/src/com/android/browser/provider/BrowserProvider2.java index 06c8e16..06ace20 100644 --- a/src/com/android/browser/provider/BrowserProvider2.java +++ b/src/com/android/browser/provider/BrowserProvider2.java @@ -518,18 +518,21 @@ public class BrowserProvider2 extends SQLiteContentProvider { null, null, null); if (c != null) { while (c.moveToNext()) { + String url = c.getString(0); + if (TextUtils.isEmpty(url)) + continue; // We require a valid URL ContentValues values = new ContentValues(); - values.put(Bookmarks.URL, c.getString(0)); + values.put(Bookmarks.URL, url); values.put(Bookmarks.TITLE, c.getString(1)); values.put(Bookmarks.DATE_CREATED, c.getInt(4)); values.put(Bookmarks.POSITION, 0); values.put(Bookmarks.PARENT, FIXED_ID_ROOT); ContentValues imageValues = new ContentValues(); - imageValues.put(Images.URL, c.getString(0)); + imageValues.put(Images.URL, url); imageValues.put(Images.FAVICON, c.getBlob(2)); imageValues.put(Images.TOUCH_ICON, c.getBlob(3)); - db.insertOrThrow(TABLE_IMAGES, Images.THUMBNAIL, imageValues); - db.insertOrThrow(TABLE_BOOKMARKS, Bookmarks.DIRTY, values); + db.insert(TABLE_IMAGES, Images.THUMBNAIL, imageValues); + db.insert(TABLE_BOOKMARKS, Bookmarks.DIRTY, values); } c.close(); } @@ -547,12 +550,15 @@ public class BrowserProvider2 extends SQLiteContentProvider { if (c != null) { while (c.moveToNext()) { ContentValues values = new ContentValues(); - values.put(History.URL, c.getString(0)); + String url = c.getString(0); + if (TextUtils.isEmpty(url)) + continue; // We require a valid URL + values.put(History.URL, url); values.put(History.TITLE, c.getString(1)); values.put(History.VISITS, c.getInt(2)); values.put(History.DATE_LAST_VISITED, c.getLong(3)); values.put(History.DATE_CREATED, c.getLong(4)); - db.insertOrThrow(TABLE_HISTORY, History.FAVICON, values); + db.insert(TABLE_HISTORY, History.FAVICON, values); } c.close(); } |