зеркало из https://github.com/mozilla/gecko-dev.git
Bug 735475 - Invert AndroidBrowserRepositorySession.checkRecordType into shouldIgnore. r=nalexander
This commit is contained in:
Родитель
6f5e3062f0
Коммит
acdc6d177c
|
@ -459,21 +459,21 @@ public class AndroidBrowserBookmarksRepositorySession extends AndroidBrowserRepo
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean checkRecordType(Record record) {
|
protected boolean shouldIgnore(Record record) {
|
||||||
if (!(record instanceof BookmarkRecord)) {
|
if (!(record instanceof BookmarkRecord)) {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
if (record.deleted) {
|
if (record.deleted) {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
BookmarkRecord bmk = (BookmarkRecord) record;
|
BookmarkRecord bmk = (BookmarkRecord) record;
|
||||||
|
|
||||||
if (bmk.isBookmark() ||
|
if (bmk.isBookmark() ||
|
||||||
bmk.isFolder()) {
|
bmk.isFolder()) {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
Logger.info(LOG_TAG, "Ignoring record with guid: " + bmk.guid + " and type: " + bmk.type);
|
Logger.info(LOG_TAG, "Ignoring record with guid: " + bmk.guid + " and type: " + bmk.type);
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,40 +1,6 @@
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
*
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
|
||||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
||||||
* for the specific language governing rights and limitations under the
|
|
||||||
* License.
|
|
||||||
*
|
|
||||||
* The Original Code is Android Sync Client.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* the Mozilla Foundation.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Jason Voll <jvoll@mozilla.com>
|
|
||||||
* Richard Newman <rnewman@mozilla.com>
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
||||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
package org.mozilla.gecko.sync.repositories.android;
|
package org.mozilla.gecko.sync.repositories.android;
|
||||||
|
|
||||||
|
@ -118,9 +84,13 @@ public abstract class AndroidBrowserRepositorySession extends StoreTrackingRepos
|
||||||
*/
|
*/
|
||||||
protected abstract Record retrieveDuringFetch(Cursor cur) throws NoGuidForIdException, NullCursorException, ParentNotFoundException;
|
protected abstract Record retrieveDuringFetch(Cursor cur) throws NoGuidForIdException, NullCursorException, ParentNotFoundException;
|
||||||
|
|
||||||
// Must be overriden by AndroidBookmarkRepositorySession.
|
/**
|
||||||
protected boolean checkRecordType(Record record) {
|
* Override this to allow records to be skipped during insertion.
|
||||||
return true;
|
*
|
||||||
|
* For example, a session subclass might skip records of an unsupported type.
|
||||||
|
*/
|
||||||
|
protected boolean shouldIgnore(Record record) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -393,8 +363,8 @@ public abstract class AndroidBrowserRepositorySession extends StoreTrackingRepos
|
||||||
// including livemarks and queries, are simply ignored.
|
// including livemarks and queries, are simply ignored.
|
||||||
// See Bug 708149. This might be resolved by Fennec changing its database
|
// See Bug 708149. This might be resolved by Fennec changing its database
|
||||||
// schema, or by Sync storing non-applied records in its own private database.
|
// schema, or by Sync storing non-applied records in its own private database.
|
||||||
if (!checkRecordType(record)) {
|
if (shouldIgnore(record)) {
|
||||||
Logger.debug(LOG_TAG, "Ignoring record " + record.guid + " due to unknown record type.");
|
Logger.debug(LOG_TAG, "Ignoring record " + record.guid);
|
||||||
|
|
||||||
// Don't throw: we don't want to abort the entire sync when we get a livemark!
|
// Don't throw: we don't want to abort the entire sync when we get a livemark!
|
||||||
// delegate.onRecordStoreFailed(new InvalidBookmarkTypeException(null));
|
// delegate.onRecordStoreFailed(new InvalidBookmarkTypeException(null));
|
||||||
|
|
Загрузка…
Ссылка в новой задаче