nus-yam/ex-repair huggingface dataset:
Program: 152514
Project: 152514
Buggy source:
/** 
 * Execute   {@link SQLiteStatement} that will update the{@link Contacts#STARRED} flag for the given {@link Contacts#_ID}.
 */
protected void updateStarred(long contactId){
  mStarredUpdate.bindLong(1,contactId);
  mStarredUpdate.execute();
}

Fixed version (ground truth):
/** 
 * Execute   {@link SQLiteStatement} that will update the{@link Contacts#STARRED} flag for the given {@link RawContacts#_ID}.
 */
protected void updateStarred(long rawContactId){
  long contactId=mDbHelper.getContactId(rawContactId);
  if (contactId == 0) {
    return;
  }
  mStarredUpdate.bindLong(1,contactId);
  mStarredUpdate.execute();
}
Program: 152515
Project: 152515
Buggy source:
/** 
 * Execute   {@link SQLiteStatement} that will update the{@link Contacts#STARRED} flag for the given {@link Contacts#_ID}.
 */
protected void updateStarred(long contactId){
  mStarredUpdate.bindLong(1,contactId);
  mStarredUpdate.execute();
}

Fixed version (ground truth):
/** 
 * Execute   {@link SQLiteStatement} that will update the{@link Contacts#STARRED} flag for the given {@link RawContacts#_ID}.
 */
protected void updateStarred(long rawContactId){
  long contactId=mDbHelper.getContactId(rawContactId);
  if (contactId == 0) {
    return;
  }
  mStarredUpdate.bindLong(1,contactId);
  mStarredUpdate.execute();
}
Program: 152516
Project: 152516
Buggy source:
/** 
 * Execute   {@link SQLiteStatement} that will update the{@link Contacts#STARRED} flag for the given {@link Contacts#_ID}.
 */
protected void updateStarred(long contactId){
  mStarredUpdate.bindLong(1,contactId);
  mStarredUpdate.execute();
}

Fixed version (ground truth):
/** 
 * Execute   {@link SQLiteStatement} that will update the{@link Contacts#STARRED} flag for the given {@link RawContacts#_ID}.
 */
protected void updateStarred(long rawContactId){
  long contactId=mDbHelper.getContactId(rawContactId);
  if (contactId == 0) {
    return;
  }
  mStarredUpdate.bindLong(1,contactId);
  mStarredUpdate.execute();
}
Program: 152519
Project: 152519
Buggy source:
/** 
 * Adds index stats into the SQLite database to force it to always use the lookup indexes.
 */
private void updateSqliteStats(SQLiteDatabase db){
  try {
    updateIndexStats(db,Tables.RAW_CONTACTS,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.RAW_CONTACTS,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.NAME_LOOKUP,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.NAME_LOOKUP,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.NAME_LOOKUP,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.PHONE_LOOKUP,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.DATA,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.DATA,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.GROUPS,"String_Node_Str","String_Node_Str");
  }
 catch (  SQLException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Adds index stats into the SQLite database to force it to always use the lookup indexes.
 */
private void updateSqliteStats(SQLiteDatabase db){
  try {
    updateIndexStats(db,Tables.CONTACTS,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.CONTACTS,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.CONTACTS,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.RAW_CONTACTS,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.RAW_CONTACTS,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.NAME_LOOKUP,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.NAME_LOOKUP,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.NAME_LOOKUP,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.PHONE_LOOKUP,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.DATA,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.DATA,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.GROUPS,"String_Node_Str","String_Node_Str");
    updateIndexStats(db,Tables.NICKNAME_LOOKUP,"String_Node_Str","String_Node_Str");
  }
 catch (  SQLException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}
Program: 152521
Project: 152521
Buggy source:
/** 
 * Find all contacts that require aggregation and pass them through aggregation one by one. Do not call directly.  It is invoked by the scheduler.
 */
public void run(){
  if (!mEnabled) {
    return;
  }
  mCancel=false;
  SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  MatchCandidateList candidates=new MatchCandidateList();
  ContactMatcher matcher=new ContactMatcher();
  ContentValues values=new ContentValues();
  long rawContactIds[]=new long[MAX_TRANSACTION_SIZE];
  long contactIds[]=new long[MAX_TRANSACTION_SIZE];
  aggregateBatch(db,candidates,matcher,values,rawContactIds,contactIds);
}

Fixed version (ground truth):
/** 
 * Find all contacts that require aggregation and pass them through aggregation one by one. Do not call directly.  It is invoked by the scheduler.
 */
public void run(){
  if (!mEnabled) {
    return;
  }
  mCancel=false;
  SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  MatchCandidateList candidates=new MatchCandidateList();
  ContactMatcher matcher=new ContactMatcher();
  ContentValues values=new ContentValues();
  long rawContactIds[]=new long[MAX_TRANSACTION_SIZE];
  long contactIds[]=new long[MAX_TRANSACTION_SIZE];
  while (!mCancel) {
    if (!aggregateBatch(db,candidates,matcher,values,rawContactIds,contactIds)) {
      break;
    }
  }
}
Program: 152523
Project: 152523
Buggy source:
/** 
 * Find all contacts that require aggregation and pass them through aggregation one by one. Do not call directly.  It is invoked by the scheduler.
 */
public void run(){
  if (!mEnabled) {
    return;
  }
  mCancel=false;
  SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  MatchCandidateList candidates=new MatchCandidateList();
  ContactMatcher matcher=new ContactMatcher();
  ContentValues values=new ContentValues();
  long rawContactIds[]=new long[MAX_TRANSACTION_SIZE];
  long contactIds[]=new long[MAX_TRANSACTION_SIZE];
  aggregateBatch(db,candidates,matcher,values,rawContactIds,contactIds);
}

Fixed version (ground truth):
/** 
 * Find all contacts that require aggregation and pass them through aggregation one by one. Do not call directly.  It is invoked by the scheduler.
 */
public void run(){
  if (!mEnabled) {
    return;
  }
  mCancel=false;
  SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  MatchCandidateList candidates=new MatchCandidateList();
  ContactMatcher matcher=new ContactMatcher();
  ContentValues values=new ContentValues();
  long rawContactIds[]=new long[MAX_TRANSACTION_SIZE];
  long contactIds[]=new long[MAX_TRANSACTION_SIZE];
  while (!mCancel) {
    if (!aggregateBatch(db,candidates,matcher,values,rawContactIds,contactIds)) {
      break;
    }
  }
}
Program: 152525
Project: 152525
Buggy source:
/** 
 * Find all contacts that require aggregation and pass them through aggregation one by one. Do not call directly.  It is invoked by the scheduler.
 */
public void run(){
  if (!mEnabled) {
    return;
  }
  mCancel=false;
  SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  MatchCandidateList candidates=new MatchCandidateList();
  ContactMatcher matcher=new ContactMatcher();
  ContentValues values=new ContentValues();
  long rawContactIds[]=new long[MAX_TRANSACTION_SIZE];
  long contactIds[]=new long[MAX_TRANSACTION_SIZE];
  aggregateBatch(db,candidates,matcher,values,rawContactIds,contactIds);
}

Fixed version (ground truth):
/** 
 * Find all contacts that require aggregation and pass them through aggregation one by one. Do not call directly.  It is invoked by the scheduler.
 */
public void run(){
  if (!mEnabled) {
    return;
  }
  mCancel=false;
  SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  MatchCandidateList candidates=new MatchCandidateList();
  ContactMatcher matcher=new ContactMatcher();
  ContentValues values=new ContentValues();
  long rawContactIds[]=new long[MAX_TRANSACTION_SIZE];
  long contactIds[]=new long[MAX_TRANSACTION_SIZE];
  while (!mCancel) {
    if (!aggregateBatch(db,candidates,matcher,values,rawContactIds,contactIds)) {
      break;
    }
  }
}
Program: 152527
Project: 152527
Buggy source:
public void updateAggregateData(long contactId){
  if (!mEnabled) {
    return;
  }
  final SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  final ContentValues values=new ContentValues();
  computeAggregateData(db,RawContacts.CONTACT_ID + "String_Node_Str" + contactId,values);
  db.update(Tables.CONTACTS,values,Contacts._ID + "String_Node_Str" + contactId,null);
  mAggregatedPresenceReplace.bindLong(1,contactId);
  mAggregatedPresenceReplace.bindLong(2,contactId);
  mAggregatedPresenceReplace.execute();
}

Fixed version (ground truth):
public void updateAggregateData(long contactId){
  if (!mEnabled) {
    return;
  }
  final SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  final ContentValues values=new ContentValues();
  computeAggregateData(db,contactId,values);
  db.update(Tables.CONTACTS,values,Contacts._ID + "String_Node_Str" + contactId,null);
  mAggregatedPresenceReplace.bindLong(1,contactId);
  mAggregatedPresenceReplace.bindLong(2,contactId);
  mAggregatedPresenceReplace.execute();
}
Program: 152529
Project: 152529
Buggy source:
private int updateAggregationException(SQLiteDatabase db,ContentValues values){
  int exceptionType=values.getAsInteger(AggregationExceptions.TYPE);
  long rcId1=values.getAsInteger(AggregationExceptions.RAW_CONTACT_ID1);
  long rcId2=values.getAsInteger(AggregationExceptions.RAW_CONTACT_ID2);
  long rawContactId1, rawContactId2;
  if (rcId1 < rcId2) {
    rawContactId1=rcId1;
    rawContactId2=rcId2;
  }
 else {
    rawContactId2=rcId1;
    rawContactId1=rcId2;
  }
  if (exceptionType == AggregationExceptions.TYPE_AUTOMATIC) {
    db.delete(Tables.AGGREGATION_EXCEPTIONS,AggregationExceptions.RAW_CONTACT_ID1 + "String_Node_Str" + rawContactId1+ "String_Node_Str"+ AggregationExceptions.RAW_CONTACT_ID2+ "String_Node_Str"+ rawContactId2,null);
  }
 else {
    ContentValues exceptionValues=new ContentValues(3);
    exceptionValues.put(AggregationExceptions.TYPE,exceptionType);
    exceptionValues.put(AggregationExceptions.RAW_CONTACT_ID1,rawContactId1);
    exceptionValues.put(AggregationExceptions.RAW_CONTACT_ID2,rawContactId2);
    db.replace(Tables.AGGREGATION_EXCEPTIONS,AggregationExceptions._ID,exceptionValues);
  }
  long contactId1=mOpenHelper.getContactId(rawContactId1);
  mContactAggregator.aggregateContact(db,rawContactId1,contactId1);
  long contactId2=mOpenHelper.getContactId(rawContactId2);
  mContactAggregator.aggregateContact(db,rawContactId2,contactId2);
  return 1;
}

Fixed version (ground truth):
private int updateAggregationException(SQLiteDatabase db,ContentValues values){
  int exceptionType=values.getAsInteger(AggregationExceptions.TYPE);
  long rcId1=values.getAsInteger(AggregationExceptions.RAW_CONTACT_ID1);
  long rcId2=values.getAsInteger(AggregationExceptions.RAW_CONTACT_ID2);
  long rawContactId1, rawContactId2;
  if (rcId1 < rcId2) {
    rawContactId1=rcId1;
    rawContactId2=rcId2;
  }
 else {
    rawContactId2=rcId1;
    rawContactId1=rcId2;
  }
  if (exceptionType == AggregationExceptions.TYPE_AUTOMATIC) {
    db.delete(Tables.AGGREGATION_EXCEPTIONS,AggregationExceptions.RAW_CONTACT_ID1 + "String_Node_Str" + rawContactId1+ "String_Node_Str"+ AggregationExceptions.RAW_CONTACT_ID2+ "String_Node_Str"+ rawContactId2,null);
  }
 else {
    ContentValues exceptionValues=new ContentValues(3);
    exceptionValues.put(AggregationExceptions.TYPE,exceptionType);
    exceptionValues.put(AggregationExceptions.RAW_CONTACT_ID1,rawContactId1);
    exceptionValues.put(AggregationExceptions.RAW_CONTACT_ID2,rawContactId2);
    db.replace(Tables.AGGREGATION_EXCEPTIONS,AggregationExceptions._ID,exceptionValues);
  }
  mContactAggregator.markForAggregation(rawContactId1);
  mContactAggregator.markForAggregation(rawContactId2);
  long contactId1=mOpenHelper.getContactId(rawContactId1);
  mContactAggregator.aggregateContact(db,rawContactId1,contactId1);
  long contactId2=mOpenHelper.getContactId(rawContactId2);
  mContactAggregator.aggregateContact(db,rawContactId2,contactId2);
  return 1;
}
Program: 152530
Project: 152530
Buggy source:
public void testAggregationExceptionKeepOutCheckUpdatesDisplayName(){
  long rawContactId1=createRawContact();
  insertStructuredName(rawContactId1,"String_Node_Str","String_Node_Str");
  long rawContactId2=createRawContact();
  insertStructuredName(rawContactId2,"String_Node_Str","String_Node_Str");
  setAggregationException(AggregationExceptions.TYPE_KEEP_TOGETHER,rawContactId1,rawContactId2);
  assertAggregated(rawContactId1,rawContactId2,"String_Node_Str");
  setAggregationException(AggregationExceptions.TYPE_KEEP_SEPARATE,rawContactId1,rawContactId2);
  assertNotAggregated(rawContactId1,rawContactId2);
  String displayName1=queryDisplayName(queryContactId(rawContactId1));
  assertEquals("String_Node_Str",displayName1);
  String displayName2=queryDisplayName(queryContactId(rawContactId2));
  assertEquals("String_Node_Str",displayName2);
}

Fixed version (ground truth):
public void testAggregationExceptionKeepOutCheckUpdatesDisplayName(){
  long rawContactId1=createRawContact();
  insertStructuredName(rawContactId1,"String_Node_Str","String_Node_Str");
  long rawContactId2=createRawContact();
  insertStructuredName(rawContactId2,"String_Node_Str","String_Node_Str");
  long rawContactId3=createRawContact();
  insertStructuredName(rawContactId3,"String_Node_Str","String_Node_Str");
  setAggregationException(AggregationExceptions.TYPE_KEEP_TOGETHER,rawContactId1,rawContactId2);
  setAggregationException(AggregationExceptions.TYPE_KEEP_TOGETHER,rawContactId1,rawContactId3);
  setAggregationException(AggregationExceptions.TYPE_KEEP_TOGETHER,rawContactId2,rawContactId3);
  assertAggregated(rawContactId1,rawContactId2,"String_Node_Str");
  assertAggregated(rawContactId1,rawContactId3);
  setAggregationException(AggregationExceptions.TYPE_KEEP_SEPARATE,rawContactId1,rawContactId2);
  setAggregationException(AggregationExceptions.TYPE_KEEP_SEPARATE,rawContactId1,rawContactId3);
  assertNotAggregated(rawContactId1,rawContactId2);
  assertNotAggregated(rawContactId1,rawContactId3);
  String displayName1=queryDisplayName(queryContactId(rawContactId1));
  assertEquals("String_Node_Str",displayName1);
  assertAggregated(rawContactId2,rawContactId3,"String_Node_Str");
  setAggregationException(AggregationExceptions.TYPE_KEEP_SEPARATE,rawContactId2,rawContactId3);
  assertNotAggregated(rawContactId1,rawContactId2);
  assertNotAggregated(rawContactId1,rawContactId3);
  assertNotAggregated(rawContactId2,rawContactId3);
  String displayName2=queryDisplayName(queryContactId(rawContactId1));
  assertEquals("String_Node_Str",displayName2);
  String displayName3=queryDisplayName(queryContactId(rawContactId2));
  assertEquals("String_Node_Str",displayName3);
  String displayName4=queryDisplayName(queryContactId(rawContactId3));
  assertEquals("String_Node_Str",displayName4);
}
Program: 152531
Project: 152531
Buggy source:
public void updateAggregateData(long contactId){
  if (!mEnabled) {
    return;
  }
  final SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  final ContentValues values=new ContentValues();
  computeAggregateData(db,RawContacts.CONTACT_ID + "String_Node_Str" + contactId,values);
  db.update(Tables.CONTACTS,values,Contacts._ID + "String_Node_Str" + contactId,null);
  mAggregatedPresenceReplace.bindLong(1,contactId);
  mAggregatedPresenceReplace.bindLong(2,contactId);
  mAggregatedPresenceReplace.execute();
}

Fixed version (ground truth):
public void updateAggregateData(long contactId){
  if (!mEnabled) {
    return;
  }
  final SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  final ContentValues values=new ContentValues();
  computeAggregateData(db,contactId,values);
  db.update(Tables.CONTACTS,values,Contacts._ID + "String_Node_Str" + contactId,null);
  mAggregatedPresenceReplace.bindLong(1,contactId);
  mAggregatedPresenceReplace.bindLong(2,contactId);
  mAggregatedPresenceReplace.execute();
}
Program: 152533
Project: 152533
Buggy source:
private int updateAggregationException(SQLiteDatabase db,ContentValues values){
  int exceptionType=values.getAsInteger(AggregationExceptions.TYPE);
  long rcId1=values.getAsInteger(AggregationExceptions.RAW_CONTACT_ID1);
  long rcId2=values.getAsInteger(AggregationExceptions.RAW_CONTACT_ID2);
  long rawContactId1, rawContactId2;
  if (rcId1 < rcId2) {
    rawContactId1=rcId1;
    rawContactId2=rcId2;
  }
 else {
    rawContactId2=rcId1;
    rawContactId1=rcId2;
  }
  if (exceptionType == AggregationExceptions.TYPE_AUTOMATIC) {
    db.delete(Tables.AGGREGATION_EXCEPTIONS,AggregationExceptions.RAW_CONTACT_ID1 + "String_Node_Str" + rawContactId1+ "String_Node_Str"+ AggregationExceptions.RAW_CONTACT_ID2+ "String_Node_Str"+ rawContactId2,null);
  }
 else {
    ContentValues exceptionValues=new ContentValues(3);
    exceptionValues.put(AggregationExceptions.TYPE,exceptionType);
    exceptionValues.put(AggregationExceptions.RAW_CONTACT_ID1,rawContactId1);
    exceptionValues.put(AggregationExceptions.RAW_CONTACT_ID2,rawContactId2);
    db.replace(Tables.AGGREGATION_EXCEPTIONS,AggregationExceptions._ID,exceptionValues);
  }
  long contactId1=mOpenHelper.getContactId(rawContactId1);
  mContactAggregator.aggregateContact(db,rawContactId1,contactId1);
  long contactId2=mOpenHelper.getContactId(rawContactId2);
  mContactAggregator.aggregateContact(db,rawContactId2,contactId2);
  return 1;
}

Fixed version (ground truth):
private int updateAggregationException(SQLiteDatabase db,ContentValues values){
  int exceptionType=values.getAsInteger(AggregationExceptions.TYPE);
  long rcId1=values.getAsInteger(AggregationExceptions.RAW_CONTACT_ID1);
  long rcId2=values.getAsInteger(AggregationExceptions.RAW_CONTACT_ID2);
  long rawContactId1, rawContactId2;
  if (rcId1 < rcId2) {
    rawContactId1=rcId1;
    rawContactId2=rcId2;
  }
 else {
    rawContactId2=rcId1;
    rawContactId1=rcId2;
  }
  if (exceptionType == AggregationExceptions.TYPE_AUTOMATIC) {
    db.delete(Tables.AGGREGATION_EXCEPTIONS,AggregationExceptions.RAW_CONTACT_ID1 + "String_Node_Str" + rawContactId1+ "String_Node_Str"+ AggregationExceptions.RAW_CONTACT_ID2+ "String_Node_Str"+ rawContactId2,null);
  }
 else {
    ContentValues exceptionValues=new ContentValues(3);
    exceptionValues.put(AggregationExceptions.TYPE,exceptionType);
    exceptionValues.put(AggregationExceptions.RAW_CONTACT_ID1,rawContactId1);
    exceptionValues.put(AggregationExceptions.RAW_CONTACT_ID2,rawContactId2);
    db.replace(Tables.AGGREGATION_EXCEPTIONS,AggregationExceptions._ID,exceptionValues);
  }
  mContactAggregator.markForAggregation(rawContactId1);
  mContactAggregator.markForAggregation(rawContactId2);
  long contactId1=mOpenHelper.getContactId(rawContactId1);
  mContactAggregator.aggregateContact(db,rawContactId1,contactId1);
  long contactId2=mOpenHelper.getContactId(rawContactId2);
  mContactAggregator.aggregateContact(db,rawContactId2,contactId2);
  return 1;
}
Program: 152534
Project: 152534
Buggy source:
public void testAggregationExceptionKeepOutCheckUpdatesDisplayName(){
  long rawContactId1=createRawContact();
  insertStructuredName(rawContactId1,"String_Node_Str","String_Node_Str");
  long rawContactId2=createRawContact();
  insertStructuredName(rawContactId2,"String_Node_Str","String_Node_Str");
  setAggregationException(AggregationExceptions.TYPE_KEEP_TOGETHER,rawContactId1,rawContactId2);
  assertAggregated(rawContactId1,rawContactId2,"String_Node_Str");
  setAggregationException(AggregationExceptions.TYPE_KEEP_SEPARATE,rawContactId1,rawContactId2);
  assertNotAggregated(rawContactId1,rawContactId2);
  String displayName1=queryDisplayName(queryContactId(rawContactId1));
  assertEquals("String_Node_Str",displayName1);
  String displayName2=queryDisplayName(queryContactId(rawContactId2));
  assertEquals("String_Node_Str",displayName2);
}

Fixed version (ground truth):
public void testAggregationExceptionKeepOutCheckUpdatesDisplayName(){
  long rawContactId1=createRawContact();
  insertStructuredName(rawContactId1,"String_Node_Str","String_Node_Str");
  long rawContactId2=createRawContact();
  insertStructuredName(rawContactId2,"String_Node_Str","String_Node_Str");
  long rawContactId3=createRawContact();
  insertStructuredName(rawContactId3,"String_Node_Str","String_Node_Str");
  setAggregationException(AggregationExceptions.TYPE_KEEP_TOGETHER,rawContactId1,rawContactId2);
  setAggregationException(AggregationExceptions.TYPE_KEEP_TOGETHER,rawContactId1,rawContactId3);
  setAggregationException(AggregationExceptions.TYPE_KEEP_TOGETHER,rawContactId2,rawContactId3);
  assertAggregated(rawContactId1,rawContactId2,"String_Node_Str");
  assertAggregated(rawContactId1,rawContactId3);
  setAggregationException(AggregationExceptions.TYPE_KEEP_SEPARATE,rawContactId1,rawContactId2);
  setAggregationException(AggregationExceptions.TYPE_KEEP_SEPARATE,rawContactId1,rawContactId3);
  assertNotAggregated(rawContactId1,rawContactId2);
  assertNotAggregated(rawContactId1,rawContactId3);
  String displayName1=queryDisplayName(queryContactId(rawContactId1));
  assertEquals("String_Node_Str",displayName1);
  assertAggregated(rawContactId2,rawContactId3,"String_Node_Str");
  setAggregationException(AggregationExceptions.TYPE_KEEP_SEPARATE,rawContactId2,rawContactId3);
  assertNotAggregated(rawContactId1,rawContactId2);
  assertNotAggregated(rawContactId1,rawContactId3);
  assertNotAggregated(rawContactId2,rawContactId3);
  String displayName2=queryDisplayName(queryContactId(rawContactId1));
  assertEquals("String_Node_Str",displayName2);
  String displayName3=queryDisplayName(queryContactId(rawContactId2));
  assertEquals("String_Node_Str",displayName3);
  String displayName4=queryDisplayName(queryContactId(rawContactId3));
  assertEquals("String_Node_Str",displayName4);
}
Program: 152535
Project: 152535
Buggy source:
public void updateAggregateData(long contactId){
  if (!mEnabled) {
    return;
  }
  final SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  final ContentValues values=new ContentValues();
  computeAggregateData(db,RawContacts.CONTACT_ID + "String_Node_Str" + contactId,values);
  db.update(Tables.CONTACTS,values,Contacts._ID + "String_Node_Str" + contactId,null);
  mAggregatedPresenceReplace.bindLong(1,contactId);
  mAggregatedPresenceReplace.bindLong(2,contactId);
  mAggregatedPresenceReplace.execute();
}

Fixed version (ground truth):
public void updateAggregateData(long contactId){
  if (!mEnabled) {
    return;
  }
  final SQLiteDatabase db=mOpenHelper.getWritableDatabase();
  final ContentValues values=new ContentValues();
  computeAggregateData(db,contactId,values);
  db.update(Tables.CONTACTS,values,Contacts._ID + "String_Node_Str" + contactId,null);
  mAggregatedPresenceReplace.bindLong(1,contactId);
  mAggregatedPresenceReplace.bindLong(2,contactId);
  mAggregatedPresenceReplace.execute();
}
Program: 152537
Project: 152537
Buggy source:
private int updateAggregationException(SQLiteDatabase db,ContentValues values){
  int exceptionType=values.getAsInteger(AggregationExceptions.TYPE);
  long rcId1=values.getAsInteger(AggregationExceptions.RAW_CONTACT_ID1);
  long rcId2=values.getAsInteger(AggregationExceptions.RAW_CONTACT_ID2);
  long rawContactId1, rawContactId2;
  if (rcId1 < rcId2) {
    rawContactId1=rcId1;
    rawContactId2=rcId2;
  }
 else {
    rawContactId2=rcId1;
    rawContactId1=rcId2;
  }
  if (exceptionType == AggregationExceptions.TYPE_AUTOMATIC) {
    db.delete(Tables.AGGREGATION_EXCEPTIONS,AggregationExceptions.RAW_CONTACT_ID1 + "String_Node_Str" + rawContactId1+ "String_Node_Str"+ AggregationExceptions.RAW_CONTACT_ID2+ "String_Node_Str"+ rawContactId2,null);
  }
 else {
    ContentValues exceptionValues=new ContentValues(3);
    exceptionValues.put(AggregationExceptions.TYPE,exceptionType);
    exceptionValues.put(AggregationExceptions.RAW_CONTACT_ID1,rawContactId1);
    exceptionValues.put(AggregationExceptions.RAW_CONTACT_ID2,rawContactId2);
    db.replace(Tables.AGGREGATION_EXCEPTIONS,AggregationExceptions._ID,exceptionValues);
  }
  long contactId1=mOpenHelper.getContactId(rawContactId1);
  mContactAggregator.aggregateContact(db,rawContactId1,contactId1);
  long contactId2=mOpenHelper.getContactId(rawContactId2);
  mContactAggregator.aggregateContact(db,rawContactId2,contactId2);
  return 1;
}

Fixed version (ground truth):
private int updateAggregationException(SQLiteDatabase db,ContentValues values){
  int exceptionType=values.getAsInteger(AggregationExceptions.TYPE);
  long rcId1=values.getAsInteger(AggregationExceptions.RAW_CONTACT_ID1);
  long rcId2=values.getAsInteger(AggregationExceptions.RAW_CONTACT_ID2);
  long rawContactId1, rawContactId2;
  if (rcId1 < rcId2) {
    rawContactId1=rcId1;
    rawContactId2=rcId2;
  }
 else {
    rawContactId2=rcId1;
    rawContactId1=rcId2;
  }
  if (exceptionType == AggregationExceptions.TYPE_AUTOMATIC) {
    db.delete(Tables.AGGREGATION_EXCEPTIONS,AggregationExceptions.RAW_CONTACT_ID1 + "String_Node_Str" + rawContactId1+ "String_Node_Str"+ AggregationExceptions.RAW_CONTACT_ID2+ "String_Node_Str"+ rawContactId2,null);
  }
 else {
    ContentValues exceptionValues=new ContentValues(3);
    exceptionValues.put(AggregationExceptions.TYPE,exceptionType);
    exceptionValues.put(AggregationExceptions.RAW_CONTACT_ID1,rawContactId1);
    exceptionValues.put(AggregationExceptions.RAW_CONTACT_ID2,rawContactId2);
    db.replace(Tables.AGGREGATION_EXCEPTIONS,AggregationExceptions._ID,exceptionValues);
  }
  mContactAggregator.markForAggregation(rawContactId1);
  mContactAggregator.markForAggregation(rawContactId2);
  long contactId1=mOpenHelper.getContactId(rawContactId1);
  mContactAggregator.aggregateContact(db,rawContactId1,contactId1);
  long contactId2=mOpenHelper.getContactId(rawContactId2);
  mContactAggregator.aggregateContact(db,rawContactId2,contactId2);
  return 1;
}
Program: 152538
Project: 152538
Buggy source:
public void testAggregationExceptionKeepOutCheckUpdatesDisplayName(){
  long rawContactId1=createRawContact();
  insertStructuredName(rawContactId1,"String_Node_Str","String_Node_Str");
  long rawContactId2=createRawContact();
  insertStructuredName(rawContactId2,"String_Node_Str","String_Node_Str");
  setAggregationException(AggregationExceptions.TYPE_KEEP_TOGETHER,rawContactId1,rawContactId2);
  assertAggregated(rawContactId1,rawContactId2,"String_Node_Str");
  setAggregationException(AggregationExceptions.TYPE_KEEP_SEPARATE,rawContactId1,rawContactId2);
  assertNotAggregated(rawContactId1,rawContactId2);
  String displayName1=queryDisplayName(queryContactId(rawContactId1));
  assertEquals("String_Node_Str",displayName1);
  String displayName2=queryDisplayName(queryContactId(rawContactId2));
  assertEquals("String_Node_Str",displayName2);
}

Fixed version (ground truth):
public void testAggregationExceptionKeepOutCheckUpdatesDisplayName(){
  long rawContactId1=createRawContact();
  insertStructuredName(rawContactId1,"String_Node_Str","String_Node_Str");
  long rawContactId2=createRawContact();
  insertStructuredName(rawContactId2,"String_Node_Str","String_Node_Str");
  long rawContactId3=createRawContact();
  insertStructuredName(rawContactId3,"String_Node_Str","String_Node_Str");
  setAggregationException(AggregationExceptions.TYPE_KEEP_TOGETHER,rawContactId1,rawContactId2);
  setAggregationException(AggregationExceptions.TYPE_KEEP_TOGETHER,rawContactId1,rawContactId3);
  setAggregationException(AggregationExceptions.TYPE_KEEP_TOGETHER,rawContactId2,rawContactId3);
  assertAggregated(rawContactId1,rawContactId2,"String_Node_Str");
  assertAggregated(rawContactId1,rawContactId3);
  setAggregationException(AggregationExceptions.TYPE_KEEP_SEPARATE,rawContactId1,rawContactId2);
  setAggregationException(AggregationExceptions.TYPE_KEEP_SEPARATE,rawContactId1,rawContactId3);
  assertNotAggregated(rawContactId1,rawContactId2);
  assertNotAggregated(rawContactId1,rawContactId3);
  String displayName1=queryDisplayName(queryContactId(rawContactId1));
  assertEquals("String_Node_Str",displayName1);
  assertAggregated(rawContactId2,rawContactId3,"String_Node_Str");
  setAggregationException(AggregationExceptions.TYPE_KEEP_SEPARATE,rawContactId2,rawContactId3);
  assertNotAggregated(rawContactId1,rawContactId2);
  assertNotAggregated(rawContactId1,rawContactId3);
  assertNotAggregated(rawContactId2,rawContactId3);
  String displayName2=queryDisplayName(queryContactId(rawContactId1));
  assertEquals("String_Node_Str",displayName2);
  String displayName3=queryDisplayName(queryContactId(rawContactId2));
  assertEquals("String_Node_Str",displayName3);
  String displayName4=queryDisplayName(queryContactId(rawContactId3));
  assertEquals("String_Node_Str",displayName4);
}
Program: 152539
Project: 152539
Buggy source:
/** 
 * Returns a list of IDs for contacts that are matched on secondary data elements (phone number, email address, nickname). We still need to obtain the approximate primary score for those contacts to determine if any of them should be aggregated. <p> May return null.
 */
public List<Long> prepareSecondaryMatchCandidates(int threshold){
  ArrayList<Long> contactIds=null;
  for (int i=0; i < mScoreCount; i++) {
    MatchScore score=mScoreList.get(i);
    if (score.mKeepOut) {
      continue;
    }
    int s=score.mSecondaryScore;
    if (s >= threshold) {
      if (contactIds == null) {
        contactIds=new ArrayList<Long>();
      }
      contactIds.add(score.mContactId);
      score.mPrimaryScore=NO_DATA_SCORE;
    }
  }
  return contactIds;
}

Fixed version (ground truth):
/** 
 * Returns a list of IDs for contacts that are matched on secondary data elements (phone number, email address, nickname). We still need to obtain the approximate primary score for those contacts to determine if any of them should be aggregated. <p> May return null.
 */
public List<Long> prepareSecondaryMatchCandidates(int threshold){
  ArrayList<Long> contactIds=null;
  for (int i=0; i < mScoreCount; i++) {
    MatchScore score=mScoreList.get(i);
    if (score.mKeepOut) {
      continue;
    }
    int s=score.mSecondaryScore;
    if (s >= threshold) {
      if (contactIds == null) {
        contactIds=new ArrayList<Long>();
      }
      contactIds.add(score.mContactId);
    }
    score.mPrimaryScore=NO_DATA_SCORE;
  }
  return contactIds;
}
Program: 152541
Project: 152541
Buggy source:
public void testPerformance(){
  final Context targetContext=getContext();
  MockContentResolver resolver=new MockContentResolver();
  MockContext context=new MockContext(){
    @Override public Resources getResources(){
      return targetContext.getResources();
    }
  }
;
  RenamingDelegatingContext targetContextWrapper=new RenamingDelegatingContext(context,targetContext,"String_Node_Str");
  targetContextWrapper.makeExistingFilesAndDbsAccessible();
  IsolatedContext providerContext=new IsolatedContext(resolver,targetContextWrapper);
  TestAggregationScheduler scheduler=new TestAggregationScheduler();
  SynchronousContactsProvider2 provider=new SynchronousContactsProvider2(scheduler);
  provider.setDataWipeEnabled(false);
  provider.attachInfo(providerContext,null);
  resolver.addProvider(ContactsContract.AUTHORITY,provider);
  long rawContactCount=provider.getRawContactCount();
  if (rawContactCount == 0) {
    Log.w(TAG,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    return;
  }
  provider.prepareForFullAggregation(500);
  rawContactCount=provider.getRawContactCount();
  long start=System.currentTimeMillis();
  if (TRACE) {
    Debug.startMethodTracing("String_Node_Str");
  }
  scheduler.trigger();
  if (TRACE) {
    Debug.stopMethodTracing();
  }
  long end=System.currentTimeMillis();
  long contactCount=provider.getContactCount();
  Log.i(TAG,String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",end - start,rawContactCount,contactCount,((double)(end - start) / rawContactCount)));
}

Fixed version (ground truth):
public void testPerformance(){
  final Context targetContext=getContext();
  MockContentResolver resolver=new MockContentResolver();
  MockContext context=new MockContext(){
    @Override public Resources getResources(){
      return targetContext.getResources();
    }
  }
;
  RenamingDelegatingContext targetContextWrapper=new RenamingDelegatingContext(context,targetContext,"String_Node_Str");
  targetContextWrapper.makeExistingFilesAndDbsAccessible();
  IsolatedContext providerContext=new IsolatedContext(resolver,targetContextWrapper);
  SynchronousContactsProvider2 provider=new SynchronousContactsProvider2();
  provider.setDataWipeEnabled(false);
  provider.attachInfo(providerContext,null);
  resolver.addProvider(ContactsContract.AUTHORITY,provider);
  long rawContactCount=provider.getRawContactCount();
  if (rawContactCount == 0) {
    Log.w(TAG,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    return;
  }
  provider.prepareForFullAggregation(500);
  rawContactCount=provider.getRawContactCount();
  long start=System.currentTimeMillis();
  if (TRACE) {
    Debug.startMethodTracing("String_Node_Str");
  }
  provider.aggregate();
  if (TRACE) {
    Debug.stopMethodTracing();
  }
  long end=System.currentTimeMillis();
  long contactCount=provider.getContactCount();
  Log.i(TAG,String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",end - start,rawContactCount,contactCount,((double)(end - start) / rawContactCount)));
}
Program: 152542
Project: 152542
Buggy source:
public void prepareForFullAggregation(int maxContact){
  SQLiteDatabase db=getOpenHelper().getWritableDatabase();
  db.execSQL("String_Node_Str" + "String_Node_Str");
  db.execSQL("String_Node_Str");
  db.execSQL("String_Node_Str");
  long rowId=db.compileStatement("String_Node_Str" + maxContact).simpleQueryForLong();
  db.execSQL("String_Node_Str" + rowId + "String_Node_Str");
}

Fixed version (ground truth):
public void prepareForFullAggregation(int maxContact){
  SQLiteDatabase db=getOpenHelper().getWritableDatabase();
  db.execSQL("String_Node_Str");
  long rowId=db.compileStatement("String_Node_Str" + maxContact).simpleQueryForLong();
  db.execSQL("String_Node_Str" + rowId + "String_Node_Str");
}
Program: 152543
Project: 152543
Buggy source:
/** 
 * Returns a list of IDs for contacts that are matched on secondary data elements (phone number, email address, nickname). We still need to obtain the approximate primary score for those contacts to determine if any of them should be aggregated. <p> May return null.
 */
public List<Long> prepareSecondaryMatchCandidates(int threshold){
  ArrayList<Long> contactIds=null;
  for (int i=0; i < mScoreCount; i++) {
    MatchScore score=mScoreList.get(i);
    if (score.mKeepOut) {
      continue;
    }
    int s=score.mSecondaryScore;
    if (s >= threshold) {
      if (contactIds == null) {
        contactIds=new ArrayList<Long>();
      }
      contactIds.add(score.mContactId);
      score.mPrimaryScore=NO_DATA_SCORE;
    }
  }
  return contactIds;
}

Fixed version (ground truth):
/** 
 * Returns a list of IDs for contacts that are matched on secondary data elements (phone number, email address, nickname). We still need to obtain the approximate primary score for those contacts to determine if any of them should be aggregated. <p> May return null.
 */
public List<Long> prepareSecondaryMatchCandidates(int threshold){
  ArrayList<Long> contactIds=null;
  for (int i=0; i < mScoreCount; i++) {
    MatchScore score=mScoreList.get(i);
    if (score.mKeepOut) {
      continue;
    }
    int s=score.mSecondaryScore;
    if (s >= threshold) {
      if (contactIds == null) {
        contactIds=new ArrayList<Long>();
      }
      contactIds.add(score.mContactId);
    }
    score.mPrimaryScore=NO_DATA_SCORE;
  }
  return contactIds;
}
Program: 152545
Project: 152545
Buggy source:
public void testPerformance(){
  final Context targetContext=getContext();
  MockContentResolver resolver=new MockContentResolver();
  MockContext context=new MockContext(){
    @Override public Resources getResources(){
      return targetContext.getResources();
    }
  }
;
  RenamingDelegatingContext targetContextWrapper=new RenamingDelegatingContext(context,targetContext,"String_Node_Str");
  targetContextWrapper.makeExistingFilesAndDbsAccessible();
  IsolatedContext providerContext=new IsolatedContext(resolver,targetContextWrapper);
  TestAggregationScheduler scheduler=new TestAggregationScheduler();
  SynchronousContactsProvider2 provider=new SynchronousContactsProvider2(scheduler);
  provider.setDataWipeEnabled(false);
  provider.attachInfo(providerContext,null);
  resolver.addProvider(ContactsContract.AUTHORITY,provider);
  long rawContactCount=provider.getRawContactCount();
  if (rawContactCount == 0) {
    Log.w(TAG,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    return;
  }
  provider.prepareForFullAggregation(500);
  rawContactCount=provider.getRawContactCount();
  long start=System.currentTimeMillis();
  if (TRACE) {
    Debug.startMethodTracing("String_Node_Str");
  }
  scheduler.trigger();
  if (TRACE) {
    Debug.stopMethodTracing();
  }
  long end=System.currentTimeMillis();
  long contactCount=provider.getContactCount();
  Log.i(TAG,String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",end - start,rawContactCount,contactCount,((double)(end - start) / rawContactCount)));
}

Fixed version (ground truth):
public void testPerformance(){
  final Context targetContext=getContext();
  MockContentResolver resolver=new MockContentResolver();
  MockContext context=new MockContext(){
    @Override public Resources getResources(){
      return targetContext.getResources();
    }
  }
;
  RenamingDelegatingContext targetContextWrapper=new RenamingDelegatingContext(context,targetContext,"String_Node_Str");
  targetContextWrapper.makeExistingFilesAndDbsAccessible();
  IsolatedContext providerContext=new IsolatedContext(resolver,targetContextWrapper);
  SynchronousContactsProvider2 provider=new SynchronousContactsProvider2();
  provider.setDataWipeEnabled(false);
  provider.attachInfo(providerContext,null);
  resolver.addProvider(ContactsContract.AUTHORITY,provider);
  long rawContactCount=provider.getRawContactCount();
  if (rawContactCount == 0) {
    Log.w(TAG,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    return;
  }
  provider.prepareForFullAggregation(500);
  rawContactCount=provider.getRawContactCount();
  long start=System.currentTimeMillis();
  if (TRACE) {
    Debug.startMethodTracing("String_Node_Str");
  }
  provider.aggregate();
  if (TRACE) {
    Debug.stopMethodTracing();
  }
  long end=System.currentTimeMillis();
  long contactCount=provider.getContactCount();
  Log.i(TAG,String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",end - start,rawContactCount,contactCount,((double)(end - start) / rawContactCount)));
}
Program: 152546
Project: 152546
Buggy source:
public void prepareForFullAggregation(int maxContact){
  SQLiteDatabase db=getOpenHelper().getWritableDatabase();
  db.execSQL("String_Node_Str" + "String_Node_Str");
  db.execSQL("String_Node_Str");
  db.execSQL("String_Node_Str");
  long rowId=db.compileStatement("String_Node_Str" + maxContact).simpleQueryForLong();
  db.execSQL("String_Node_Str" + rowId + "String_Node_Str");
}

Fixed version (ground truth):
public void prepareForFullAggregation(int maxContact){
  SQLiteDatabase db=getOpenHelper().getWritableDatabase();
  db.execSQL("String_Node_Str");
  long rowId=db.compileStatement("String_Node_Str" + maxContact).simpleQueryForLong();
  db.execSQL("String_Node_Str" + rowId + "String_Node_Str");
}
Program: 152547
Project: 152547
Buggy source:
/** 
 * Returns a list of IDs for contacts that are matched on secondary data elements (phone number, email address, nickname). We still need to obtain the approximate primary score for those contacts to determine if any of them should be aggregated. <p> May return null.
 */
public List<Long> prepareSecondaryMatchCandidates(int threshold){
  ArrayList<Long> contactIds=null;
  for (int i=0; i < mScoreCount; i++) {
    MatchScore score=mScoreList.get(i);
    if (score.mKeepOut) {
      continue;
    }
    int s=score.mSecondaryScore;
    if (s >= threshold) {
      if (contactIds == null) {
        contactIds=new ArrayList<Long>();
      }
      contactIds.add(score.mContactId);
      score.mPrimaryScore=NO_DATA_SCORE;
    }
  }
  return contactIds;
}

Fixed version (ground truth):
/** 
 * Returns a list of IDs for contacts that are matched on secondary data elements (phone number, email address, nickname). We still need to obtain the approximate primary score for those contacts to determine if any of them should be aggregated. <p> May return null.
 */
public List<Long> prepareSecondaryMatchCandidates(int threshold){
  ArrayList<Long> contactIds=null;
  for (int i=0; i < mScoreCount; i++) {
    MatchScore score=mScoreList.get(i);
    if (score.mKeepOut) {
      continue;
    }
    int s=score.mSecondaryScore;
    if (s >= threshold) {
      if (contactIds == null) {
        contactIds=new ArrayList<Long>();
      }
      contactIds.add(score.mContactId);
    }
    score.mPrimaryScore=NO_DATA_SCORE;
  }
  return contactIds;
}
Program: 152549
Project: 152549
Buggy source:
public void testPerformance(){
  final Context targetContext=getContext();
  MockContentResolver resolver=new MockContentResolver();
  MockContext context=new MockContext(){
    @Override public Resources getResources(){
      return targetContext.getResources();
    }
  }
;
  RenamingDelegatingContext targetContextWrapper=new RenamingDelegatingContext(context,targetContext,"String_Node_Str");
  targetContextWrapper.makeExistingFilesAndDbsAccessible();
  IsolatedContext providerContext=new IsolatedContext(resolver,targetContextWrapper);
  TestAggregationScheduler scheduler=new TestAggregationScheduler();
  SynchronousContactsProvider2 provider=new SynchronousContactsProvider2(scheduler);
  provider.setDataWipeEnabled(false);
  provider.attachInfo(providerContext,null);
  resolver.addProvider(ContactsContract.AUTHORITY,provider);
  long rawContactCount=provider.getRawContactCount();
  if (rawContactCount == 0) {
    Log.w(TAG,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    return;
  }
  provider.prepareForFullAggregation(500);
  rawContactCount=provider.getRawContactCount();
  long start=System.currentTimeMillis();
  if (TRACE) {
    Debug.startMethodTracing("String_Node_Str");
  }
  scheduler.trigger();
  if (TRACE) {
    Debug.stopMethodTracing();
  }
  long end=System.currentTimeMillis();
  long contactCount=provider.getContactCount();
  Log.i(TAG,String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",end - start,rawContactCount,contactCount,((double)(end - start) / rawContactCount)));
}

Fixed version (ground truth):
public void testPerformance(){
  final Context targetContext=getContext();
  MockContentResolver resolver=new MockContentResolver();
  MockContext context=new MockContext(){
    @Override public Resources getResources(){
      return targetContext.getResources();
    }
  }
;
  RenamingDelegatingContext targetContextWrapper=new RenamingDelegatingContext(context,targetContext,"String_Node_Str");
  targetContextWrapper.makeExistingFilesAndDbsAccessible();
  IsolatedContext providerContext=new IsolatedContext(resolver,targetContextWrapper);
  SynchronousContactsProvider2 provider=new SynchronousContactsProvider2();
  provider.setDataWipeEnabled(false);
  provider.attachInfo(providerContext,null);
  resolver.addProvider(ContactsContract.AUTHORITY,provider);
  long rawContactCount=provider.getRawContactCount();
  if (rawContactCount == 0) {
    Log.w(TAG,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    return;
  }
  provider.prepareForFullAggregation(500);
  rawContactCount=provider.getRawContactCount();
  long start=System.currentTimeMillis();
  if (TRACE) {
    Debug.startMethodTracing("String_Node_Str");
  }
  provider.aggregate();
  if (TRACE) {
    Debug.stopMethodTracing();
  }
  long end=System.currentTimeMillis();
  long contactCount=provider.getContactCount();
  Log.i(TAG,String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",end - start,rawContactCount,contactCount,((double)(end - start) / rawContactCount)));
}
Program: 152550
Project: 152550
Buggy source:
public void prepareForFullAggregation(int maxContact){
  SQLiteDatabase db=getOpenHelper().getWritableDatabase();
  db.execSQL("String_Node_Str" + "String_Node_Str");
  db.execSQL("String_Node_Str");
  db.execSQL("String_Node_Str");
  long rowId=db.compileStatement("String_Node_Str" + maxContact).simpleQueryForLong();
  db.execSQL("String_Node_Str" + rowId + "String_Node_Str");
}

Fixed version (ground truth):
public void prepareForFullAggregation(int maxContact){
  SQLiteDatabase db=getOpenHelper().getWritableDatabase();
  db.execSQL("String_Node_Str");
  long rowId=db.compileStatement("String_Node_Str" + maxContact).simpleQueryForLong();
  db.execSQL("String_Node_Str" + rowId + "String_Node_Str");
}
Program: 152551
Project: 152551
Buggy source:
/** 
 * Inserts an item in the data table
 * @param values the values for the new row
 * @return the row ID of the newly created row
 */
private long insertData(ContentValues values,boolean markRawContactAsDirty){
  int aggregationMode=RawContacts.AGGREGATION_MODE_DISABLED;
  long id=0;
  mValues.clear();
  mValues.putAll(values);
  long rawContactId=mValues.getAsLong(Data.RAW_CONTACT_ID);
  final String packageName=mValues.getAsString(Data.RES_PACKAGE);
  if (packageName != null) {
    mValues.put(DataColumns.PACKAGE_ID,mOpenHelper.getPackageId(packageName));
  }
  mValues.remove(Data.RES_PACKAGE);
  final String mimeType=mValues.getAsString(Data.MIMETYPE);
  if (TextUtils.isEmpty(mimeType)) {
    throw new IllegalArgumentException(Data.MIMETYPE + "String_Node_Str");
  }
  mValues.put(DataColumns.MIMETYPE_ID,mOpenHelper.getMimeTypeId(mimeType));
  mValues.remove(Data.MIMETYPE);
  id=getDataRowHandler(mimeType).insert(mDb,rawContactId,mValues);
  if (markRawContactAsDirty) {
    setRawContactDirty(rawContactId);
  }
  triggerAggregation(rawContactId);
  return id;
}

Fixed version (ground truth):
/** 
 * Inserts an item in the data table
 * @param values the values for the new row
 * @return the row ID of the newly created row
 */
private long insertData(ContentValues values,boolean markRawContactAsDirty){
  long id=0;
  mValues.clear();
  mValues.putAll(values);
  long rawContactId=mValues.getAsLong(Data.RAW_CONTACT_ID);
  final String packageName=mValues.getAsString(Data.RES_PACKAGE);
  if (packageName != null) {
    mValues.put(DataColumns.PACKAGE_ID,mOpenHelper.getPackageId(packageName));
  }
  mValues.remove(Data.RES_PACKAGE);
  final String mimeType=mValues.getAsString(Data.MIMETYPE);
  if (TextUtils.isEmpty(mimeType)) {
    throw new IllegalArgumentException(Data.MIMETYPE + "String_Node_Str");
  }
  mValues.put(DataColumns.MIMETYPE_ID,mOpenHelper.getMimeTypeId(mimeType));
  mValues.remove(Data.MIMETYPE);
  id=getDataRowHandler(mimeType).insert(mDb,rawContactId,mValues);
  if (markRawContactAsDirty) {
    setRawContactDirty(rawContactId);
  }
  triggerAggregation(rawContactId);
  return id;
}