Program: 152393
Project: 152393
Buggy source:
/** 
 * Given a specific raw contact, finds all matching raw contacts and re-aggregate them based on the matching connectivity.
 */
synchronized void aggregateContact(TransactionContext txContext,SQLiteDatabase db,long rawContactId,long accountId,long currentContactId,MatchCandidateList candidates){
  if (VERBOSE_LOGGING) {
    Log.v(TAG,"String_Node_Str" + rawContactId + "String_Node_Str"+ currentContactId);
  }
  int aggregationMode=RawContacts.AGGREGATION_MODE_DEFAULT;
  Integer aggModeObject=mRawContactsMarkedForAggregation.remove(rawContactId);
  if (aggModeObject != null) {
    aggregationMode=aggModeObject;
  }
  RawContactMatcher matcher=new RawContactMatcher();
  RawContactMatchingCandidates matchingCandidates=new RawContactMatchingCandidates();
  if (aggregationMode == RawContacts.AGGREGATION_MODE_DEFAULT) {
    matchingCandidates=findRawContactMatchingCandidates(db,rawContactId,candidates,matcher);
  }
 else   if (aggregationMode == RawContacts.AGGREGATION_MODE_DISABLED) {
    return;
  }
  long currentContactContentsCount=0;
  if (currentContactId != 0) {
    mRawContactCountQuery.bindLong(1,currentContactId);
    mRawContactCountQuery.bindLong(2,rawContactId);
    currentContactContentsCount=mRawContactCountQuery.simpleQueryForLong();
  }
  final int operation;
  final int candidatesCount=matchingCandidates.getCount();
  if (candidatesCount >= AGGREGATION_CONTACT_SIZE_LIMIT) {
    operation=KEEP_INTACT;
    if (VERBOSE_LOGGING) {
      Log.v(TAG,"String_Node_Str" + candidatesCount + "String_Node_Str");
    }
  }
 else   if (candidatesCount > 0) {
    operation=RE_AGGREGATE;
  }
 else {
    if (currentContactId != 0 && (currentContactContentsCount == 0 || aggregationMode == RawContacts.AGGREGATION_MODE_SUSPENDED)) {
      operation=KEEP_INTACT;
    }
 else {
      operation=CREATE_NEW_CONTACT;
    }
  }
  if (operation == KEEP_INTACT) {
    if (VERBOSE_LOGGING) {
      Log.v(TAG,"String_Node_Str");
    }
    markAggregated(rawContactId);
  }
 else   if (operation == CREATE_NEW_CONTACT) {
    if (VERBOSE_LOGGING) {
      Log.v(TAG,"String_Node_Str" + rawContactId);
    }
    createContactForRawContacts(db,txContext,Sets.newHashSet(rawContactId),null);
    if (currentContactContentsCount > 0) {
      updateAggregateData(txContext,currentContactId);
    }
  }
 else {
    if (VERBOSE_LOGGING) {
      Log.v(TAG,"String_Node_Str" + rawContactId + "String_Node_Str"+ TextUtils.join("String_Node_Str",matchingCandidates.getRawContactIdSet()));
    }
    reAggregateRawContacts(txContext,db,currentContactId,rawContactId,accountId,currentContactContentsCount,matchingCandidates);
  }
}

Fixed version (ground truth):
/** 
 * Given a specific raw contact, finds all matching raw contacts and re-aggregate them based on the matching connectivity.
 */
synchronized void aggregateContact(TransactionContext txContext,SQLiteDatabase db,long rawContactId,long accountId,long currentContactId,MatchCandidateList candidates){
  if (VERBOSE_LOGGING) {
    Log.v(TAG,"String_Node_Str" + rawContactId + "String_Node_Str"+ currentContactId);
  }
  int aggregationMode=RawContacts.AGGREGATION_MODE_DEFAULT;
  Integer aggModeObject=mRawContactsMarkedForAggregation.remove(rawContactId);
  if (aggModeObject != null) {
    aggregationMode=aggModeObject;
  }
  RawContactMatcher matcher=new RawContactMatcher();
  RawContactMatchingCandidates matchingCandidates=new RawContactMatchingCandidates();
  if (aggregationMode == RawContacts.AGGREGATION_MODE_DEFAULT) {
    if (currentContactId == 0 || mDbHelper.isContactInDefaultDirectory(db,currentContactId)) {
      matchingCandidates=findRawContactMatchingCandidates(db,rawContactId,candidates,matcher);
    }
  }
 else   if (aggregationMode == RawContacts.AGGREGATION_MODE_DISABLED) {
    return;
  }
  long currentContactContentsCount=0;
  if (currentContactId != 0) {
    mRawContactCountQuery.bindLong(1,currentContactId);
    mRawContactCountQuery.bindLong(2,rawContactId);
    currentContactContentsCount=mRawContactCountQuery.simpleQueryForLong();
  }
  final int operation;
  final int candidatesCount=matchingCandidates.getCount();
  if (candidatesCount >= AGGREGATION_CONTACT_SIZE_LIMIT) {
    operation=KEEP_INTACT;
    if (VERBOSE_LOGGING) {
      Log.v(TAG,"String_Node_Str" + candidatesCount + "String_Node_Str");
    }
  }
 else   if (candidatesCount > 0) {
    operation=RE_AGGREGATE;
  }
 else {
    if (currentContactId != 0 && (currentContactContentsCount == 0 || aggregationMode == RawContacts.AGGREGATION_MODE_SUSPENDED)) {
      operation=KEEP_INTACT;
    }
 else {
      operation=CREATE_NEW_CONTACT;
    }
  }
  if (operation == KEEP_INTACT) {
    if (VERBOSE_LOGGING) {
      Log.v(TAG,"String_Node_Str");
    }
    markAggregated(rawContactId);
  }
 else   if (operation == CREATE_NEW_CONTACT) {
    if (VERBOSE_LOGGING) {
      Log.v(TAG,"String_Node_Str" + rawContactId);
    }
    createContactForRawContacts(db,txContext,Sets.newHashSet(rawContactId),null);
    if (currentContactContentsCount > 0) {
      updateAggregateData(txContext,currentContactId);
    }
  }
 else {
    if (VERBOSE_LOGGING) {
      Log.v(TAG,"String_Node_Str" + rawContactId + "String_Node_Str"+ TextUtils.join("String_Node_Str",matchingCandidates.getRawContactIdSet()));
    }
    reAggregateRawContacts(txContext,db,currentContactId,rawContactId,accountId,currentContactContentsCount,matchingCandidates);
  }
}