diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-06-05 10:12:34 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-06-05 10:12:34 -0700 |
commit | 716b56817aee1c0b584266a686b18a1c02ea0116 (patch) | |
tree | a05a10ab05d20ec1492353140dfb30b00820a0cb | |
parent | 0e74aa0f7ed90d46e0bdde02bf9b7b29c6b95bd8 (diff) | |
parent | 7a9e348c0776d0d9ad773fbf304bff3fd0de2e7b (diff) | |
download | frameworks_base-716b56817aee1c0b584266a686b18a1c02ea0116.zip frameworks_base-716b56817aee1c0b584266a686b18a1c02ea0116.tar.gz frameworks_base-716b56817aee1c0b584266a686b18a1c02ea0116.tar.bz2 |
Merge change 2934 into donut
* changes:
Don't crash on null edit url.
-rw-r--r-- | core/java/android/content/AbstractTableMerger.java | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/core/java/android/content/AbstractTableMerger.java b/core/java/android/content/AbstractTableMerger.java index 700f1d8..94afcee 100644 --- a/core/java/android/content/AbstractTableMerger.java +++ b/core/java/android/content/AbstractTableMerger.java @@ -61,8 +61,10 @@ public abstract class AbstractTableMerger _SYNC_ID +"=? and " + _SYNC_ACCOUNT + "=?"; private static final String SELECT_BY_ID = BaseColumns._ID +"=?"; + // The last clause rejects events with a null _SYNC_VERSION if they've already been synced private static final String SELECT_UNSYNCED = "" - + _SYNC_DIRTY + " > 0 and (" + _SYNC_ACCOUNT + "=? or " + _SYNC_ACCOUNT + " is null)"; + + _SYNC_DIRTY + " > 0 and (" + _SYNC_ACCOUNT + "=? or " + _SYNC_ACCOUNT + " is null) " + + "and (" + _SYNC_VERSION + " is not null or " + _SYNC_ACCOUNT + " is null)"; public AbstractTableMerger(SQLiteDatabase database, String table, Uri tableURL, String deletedTable, @@ -365,26 +367,32 @@ public abstract class AbstractTableMerger if (!TextUtils.isEmpty(localSyncID)) { // An existing server item has changed - boolean recordChanged = (localSyncVersion == null) || - !serverSyncVersion.equals(localSyncVersion); - if (recordChanged) { - if (localSyncDirty) { - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "remote record " + serverSyncId - + " conflicts with local _sync_id " + localSyncID - + ", local _id " + localRowId); + // If serverSyncVersion is null, there is no edit URL; + // server won't let this change be written. + // Just hold onto it, I guess, in case the server permissions + // change later. + if (serverSyncVersion != null) { + boolean recordChanged = (localSyncVersion == null) || + !serverSyncVersion.equals(localSyncVersion); + if (recordChanged) { + if (localSyncDirty) { + if (Log.isLoggable(TAG, Log.VERBOSE)) { + Log.v(TAG, "remote record " + serverSyncId + + " conflicts with local _sync_id " + localSyncID + + ", local _id " + localRowId); + } + conflict = true; + } else { + if (Log.isLoggable(TAG, Log.VERBOSE)) { + Log.v(TAG, + "remote record " + + serverSyncId + + " updates local _sync_id " + + localSyncID + ", local _id " + + localRowId); + } + update = true; } - conflict = true; - } else { - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, - "remote record " + - serverSyncId + - " updates local _sync_id " + - localSyncID + ", local _id " + - localRowId); - } - update = true; } } } else { |