Bug 718238 - Part 4: Safety in checkRecordType. r=nalexander
authorRichard Newman <rnewman@mozilla.com>
Thu, 23 Feb 2012 08:14:05 -0800
changeset 87548 592043eae457788454fb5cdf09a45f8c99226e75
parent 87547 e24cbd1e7bd02bc193212f1471584035978e647e
child 87549 a67d81a9354808aab04bac12d45c1b41c0209f21
push id22130
push userrnewman@mozilla.com
push dateFri, 24 Feb 2012 02:35:54 +0000
treeherdermozilla-central@d23600a1d4a7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs718238
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 718238 - Part 4: Safety in checkRecordType. r=nalexander
mobile/android/base/sync/repositories/android/AndroidBrowserBookmarksRepositorySession.java
--- a/mobile/android/base/sync/repositories/android/AndroidBrowserBookmarksRepositorySession.java
+++ b/mobile/android/base/sync/repositories/android/AndroidBrowserBookmarksRepositorySession.java
@@ -455,22 +455,29 @@ public class AndroidBrowserBookmarksRepo
     }
 
     Logger.debug(LOG_TAG, "Fetched " + childArray.size() + " children for " + recordGUID);
     return childArray;
   }
 
   @Override
   protected boolean checkRecordType(Record record) {
-    BookmarkRecord bmk = (BookmarkRecord) record;
-    if (bmk.type.equalsIgnoreCase(AndroidBrowserBookmarksDataAccessor.TYPE_BOOKMARK) ||
-        bmk.type.equalsIgnoreCase(AndroidBrowserBookmarksDataAccessor.TYPE_FOLDER)) {
+    if (!(record instanceof BookmarkRecord)) {
+      return false;
+    }
+    if (record.deleted) {
       return true;
     }
-    Logger.info(LOG_TAG, "Ignoring record with guid: " + record.guid + " and type: " + ((BookmarkRecord)record).type);
+    BookmarkRecord bmk = (BookmarkRecord) record;
+
+    if (bmk.isBookmark() ||
+        bmk.isFolder()) {
+      return true;
+    }
+    Logger.info(LOG_TAG, "Ignoring record with guid: " + bmk.guid + " and type: " + bmk.type);
     return false;
   }
   
   @Override
   public void begin(RepositorySessionBeginDelegate delegate) {
     // Check for the existence of special folders
     // and insert them if they don't exist.
     Cursor cur;