Program: 152371
Project: 152371
Buggy source:
private void flushTransactionalChanges(){
  if (VERBOSE_LOGGING) {
    Log.v(TAG,"String_Node_Str" + (inProfileMode() ? "String_Node_Str" : "String_Node_Str"));
  }
  final SQLiteDatabase db=mDbHelper.get().getWritableDatabase();
  for (  long rawContactId : mTransactionContext.get().getInsertedRawContactIds()) {
    mDbHelper.get().updateRawContactDisplayName(db,rawContactId);
    mAggregator.get().onRawContactInsert(mTransactionContext.get(),db,rawContactId);
    if (mMetadataSyncEnabled) {
      updateMetadataOnRawContactInsert(db,rawContactId);
    }
  }
  final Set<Long> dirtyRawContacts=mTransactionContext.get().getDirtyRawContactIds();
  if (!dirtyRawContacts.isEmpty()) {
    mSb.setLength(0);
    mSb.append(UPDATE_RAW_CONTACT_SET_DIRTY_SQL);
    appendIds(mSb,dirtyRawContacts);
    mSb.append("String_Node_Str");
    db.execSQL(mSb.toString());
  }
  final Set<Long> updatedRawContacts=mTransactionContext.get().getUpdatedRawContactIds();
  if (!updatedRawContacts.isEmpty()) {
    mSb.setLength(0);
    mSb.append(UPDATE_RAW_CONTACT_SET_VERSION_SQL);
    appendIds(mSb,updatedRawContacts);
    mSb.append("String_Node_Str");
    db.execSQL(mSb.toString());
  }
  final Set<Long> metadataDirtyRawContacts=mTransactionContext.get().getMetadataDirtyRawContactIds();
  if (!metadataDirtyRawContacts.isEmpty() && mMetadataSyncEnabled) {
    mSb.setLength(0);
    mSb.append(UPDATE_RAW_CONTACT_SET_METADATA_DIRTY_SQL);
    appendIds(mSb,metadataDirtyRawContacts);
    mSb.append("String_Node_Str");
    db.execSQL(mSb.toString());
    mSyncToMetadataNetWork=true;
  }
  final Set<Long> changedRawContacts=mTransactionContext.get().getChangedRawContactIds();
  ContactsTableUtil.updateContactLastUpdateByRawContactId(db,changedRawContacts);
  if (!changedRawContacts.isEmpty() && mMetadataSyncEnabled) {
    mSb.setLength(0);
    mSb.append(UPDATE_METADATASYNC_SET_DELETED_SQL);
    appendIds(mSb,changedRawContacts);
    mSb.append("String_Node_Str");
    db.execSQL(mSb.toString());
    mSyncToMetadataNetWork=true;
  }
  for (  Map.Entry<Long,Object> entry : mTransactionContext.get().getUpdatedSyncStates()) {
    long id=entry.getKey();
    if (mDbHelper.get().getSyncState().update(db,id,entry.getValue()) <= 0) {
      throw new IllegalStateException("String_Node_Str");
    }
  }
  mTransactionContext.get().clearExceptSearchIndexUpdates();
}

Fixed version (ground truth):
private void flushTransactionalChanges(){
  if (VERBOSE_LOGGING) {
    Log.v(TAG,"String_Node_Str" + (inProfileMode() ? "String_Node_Str" : "String_Node_Str"));
  }
  final SQLiteDatabase db=mDbHelper.get().getWritableDatabase();
  for (  long rawContactId : mTransactionContext.get().getInsertedRawContactIds()) {
    mDbHelper.get().updateRawContactDisplayName(db,rawContactId);
    mAggregator.get().onRawContactInsert(mTransactionContext.get(),db,rawContactId);
    if (mMetadataSyncEnabled) {
      updateMetadataOnRawContactInsert(db,rawContactId);
    }
  }
  if (mMetadataSyncEnabled) {
    for (    long rawContactId : mTransactionContext.get().getBackupIdChangedRawContacts()) {
      updateMetadataOnRawContactInsert(db,rawContactId);
    }
  }
  final Set<Long> dirtyRawContacts=mTransactionContext.get().getDirtyRawContactIds();
  if (!dirtyRawContacts.isEmpty()) {
    mSb.setLength(0);
    mSb.append(UPDATE_RAW_CONTACT_SET_DIRTY_SQL);
    appendIds(mSb,dirtyRawContacts);
    mSb.append("String_Node_Str");
    db.execSQL(mSb.toString());
  }
  final Set<Long> updatedRawContacts=mTransactionContext.get().getUpdatedRawContactIds();
  if (!updatedRawContacts.isEmpty()) {
    mSb.setLength(0);
    mSb.append(UPDATE_RAW_CONTACT_SET_VERSION_SQL);
    appendIds(mSb,updatedRawContacts);
    mSb.append("String_Node_Str");
    db.execSQL(mSb.toString());
  }
  final Set<Long> metadataDirtyRawContacts=mTransactionContext.get().getMetadataDirtyRawContactIds();
  if (!metadataDirtyRawContacts.isEmpty() && mMetadataSyncEnabled) {
    mSb.setLength(0);
    mSb.append(UPDATE_RAW_CONTACT_SET_METADATA_DIRTY_SQL);
    appendIds(mSb,metadataDirtyRawContacts);
    mSb.append("String_Node_Str");
    db.execSQL(mSb.toString());
    mSyncToMetadataNetWork=true;
  }
  final Set<Long> changedRawContacts=mTransactionContext.get().getChangedRawContactIds();
  ContactsTableUtil.updateContactLastUpdateByRawContactId(db,changedRawContacts);
  if (!changedRawContacts.isEmpty() && mMetadataSyncEnabled) {
    mSb.setLength(0);
    mSb.append(UPDATE_METADATASYNC_SET_DELETED_SQL);
    appendIds(mSb,changedRawContacts);
    mSb.append("String_Node_Str");
    db.execSQL(mSb.toString());
    mSyncToMetadataNetWork=true;
  }
  for (  Map.Entry<Long,Object> entry : mTransactionContext.get().getUpdatedSyncStates()) {
    long id=entry.getKey();
    if (mDbHelper.get().getSyncState().update(db,id,entry.getValue()) <= 0) {
      throw new IllegalStateException("String_Node_Str");
    }
  }
  mTransactionContext.get().clearExceptSearchIndexUpdates();
}