Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 716b5681 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 2934 into donut

* changes:
  Don't crash on null edit url.
parents 0e74aa0f 7a9e348c
Loading
Loading
Loading
Loading
+28 −20
Original line number Original line Diff line number Diff line
@@ -61,8 +61,10 @@ public abstract class AbstractTableMerger
            _SYNC_ID +"=? and " + _SYNC_ACCOUNT + "=?";
            _SYNC_ID +"=? and " + _SYNC_ACCOUNT + "=?";
    private static final String SELECT_BY_ID = BaseColumns._ID +"=?";
    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 = ""
    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,
    public AbstractTableMerger(SQLiteDatabase database,
            String table, Uri tableURL, String deletedTable,
            String table, Uri tableURL, String deletedTable,
@@ -365,6 +367,11 @@ public abstract class AbstractTableMerger


            if (!TextUtils.isEmpty(localSyncID)) {
            if (!TextUtils.isEmpty(localSyncID)) {
                // An existing server item has changed
                // An existing server item has changed
                // 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) ||
                    boolean recordChanged = (localSyncVersion == null) ||
                            !serverSyncVersion.equals(localSyncVersion);
                            !serverSyncVersion.equals(localSyncVersion);
                    if (recordChanged) {
                    if (recordChanged) {
@@ -387,6 +394,7 @@ public abstract class AbstractTableMerger
                            update = true;
                            update = true;
                        }
                        }
                    }
                    }
                }
            } else {
            } else {
                // the local db doesn't know about this record so add it
                // the local db doesn't know about this record so add it
                if (Log.isLoggable(TAG, Log.VERBOSE)) {
                if (Log.isLoggable(TAG, Log.VERBOSE)) {