diff options
author | Jeff Hamilton <jham@android.com> | 2010-09-17 08:14:55 -0500 |
---|---|---|
committer | Jeff Hamilton <jham@android.com> | 2010-09-17 08:14:55 -0500 |
commit | 72cca7dfddda721f192662c3e371675d668c5f43 (patch) | |
tree | 35562f32772e5fd1d6c3525de1f040ea948c19fb | |
parent | 4d5db5dcd1b4a4e3ab358f60ff4fab9517c9ccb2 (diff) | |
download | packages_apps_browser-72cca7dfddda721f192662c3e371675d668c5f43.zip packages_apps_browser-72cca7dfddda721f192662c3e371675d668c5f43.tar.gz packages_apps_browser-72cca7dfddda721f192662c3e371675d668c5f43.tar.bz2 |
Fix crashes when inserting.
You can now have bookmarks with duplicate URLs.
Change-Id: Ie3adf413c01c6ffab3659a6947037b35f03842ef
-rw-r--r-- | res/values-ja/donottranslate_strings.xml | 2 | ||||
-rw-r--r-- | src/com/android/browser/provider/BrowserProvider2.java | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/res/values-ja/donottranslate_strings.xml b/res/values-ja/donottranslate_strings.xml index cbda8f2..026d57a 100644 --- a/res/values-ja/donottranslate_strings.xml +++ b/res/values-ja/donottranslate_strings.xml @@ -17,5 +17,5 @@ <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="pref_default_text_encoding_default">SHIFT_JIS</string> + <string name="pref_default_text_encoding_default" translatable="false">SHIFT_JIS</string> </resources> diff --git a/src/com/android/browser/provider/BrowserProvider2.java b/src/com/android/browser/provider/BrowserProvider2.java index 0112343..13377d4 100644 --- a/src/com/android/browser/provider/BrowserProvider2.java +++ b/src/com/android/browser/provider/BrowserProvider2.java @@ -797,9 +797,14 @@ public class BrowserProvider2 extends SQLiteContentProvider { // Extract out the image values so they can be inserted into the images table String url = values.getAsString(Bookmarks.URL); ContentValues imageValues = extractImageValues(values, url); - boolean isFolder = (values.getAsInteger(Bookmarks.IS_FOLDER) != 0); - if (!isFolder && imageValues != null && !TextUtils.isEmpty(url)) { - db.insertOrThrow(TABLE_IMAGES, Images.FAVICON, imageValues); + Boolean isFolder = values.getAsBoolean(Bookmarks.IS_FOLDER); + if ((isFolder == null || !isFolder) + && imageValues != null && !TextUtils.isEmpty(url)) { + int count = db.update(TABLE_IMAGES, imageValues, Images.URL + "=?", + new String[] { url }); + if (count == 0) { + db.insertOrThrow(TABLE_IMAGES, Images.FAVICON, imageValues); + } } id = db.insertOrThrow(TABLE_BOOKMARKS, Bookmarks.DIRTY, values); |