nus-yam/ex-repair huggingface dataset:
Program: 152485
Project: 152485
Buggy source:
private void insertOrganization(Cursor c,SQLiteStatement insert){
  long id=c.getLong(OrganizationsQuery.PERSON);
  insert.bindLong(OrganizationInsert.RAW_CONTACT_ID,id);
  insert.bindLong(OrganizationInsert.MIMETYPE_ID,mOrganizationMimetypeId);
  bindString(insert,OrganizationInsert.IS_PRIMARY,c.getString(OrganizationsQuery.ISPRIMARY));
  bindString(insert,OrganizationInsert.COMPANY,c.getString(OrganizationsQuery.COMPANY));
  bindString(insert,OrganizationInsert.TITLE,c.getString(OrganizationsQuery.TITLE));
  bindString(insert,OrganizationInsert.TYPE,c.getString(OrganizationsQuery.TYPE));
  bindString(insert,OrganizationInsert.LABEL,c.getString(OrganizationsQuery.LABEL));
  insert(insert);
}

Fixed version (ground truth):
private void insertOrganization(Cursor c,SQLiteStatement insert){
  long id=c.getLong(OrganizationsQuery.PERSON);
  insert.bindLong(OrganizationInsert.RAW_CONTACT_ID,id);
  insert.bindLong(OrganizationInsert.MIMETYPE_ID,mOrganizationMimetypeId);
  bindString(insert,OrganizationInsert.IS_PRIMARY,c.getString(OrganizationsQuery.ISPRIMARY));
  bindString(insert,OrganizationInsert.IS_SUPER_PRIMARY,c.getString(OrganizationsQuery.ISPRIMARY));
  bindString(insert,OrganizationInsert.COMPANY,c.getString(OrganizationsQuery.COMPANY));
  bindString(insert,OrganizationInsert.TITLE,c.getString(OrganizationsQuery.TITLE));
  bindString(insert,OrganizationInsert.TYPE,c.getString(OrganizationsQuery.TYPE));
  bindString(insert,OrganizationInsert.LABEL,c.getString(OrganizationsQuery.LABEL));
  insert(insert);
}
Program: 152486
Project: 152486
Buggy source:
private void insertPostal(Cursor c,SQLiteStatement insert){
  long personId=c.getLong(ContactMethodsQuery.PERSON);
  insert.bindLong(PostalInsert.RAW_CONTACT_ID,personId);
  insert.bindLong(PostalInsert.MIMETYPE_ID,mPostalMimetypeId);
  bindString(insert,PostalInsert.IS_PRIMARY,c.getString(ContactMethodsQuery.ISPRIMARY));
  bindString(insert,PostalInsert.DATA,c.getString(ContactMethodsQuery.DATA));
  bindString(insert,PostalInsert.AUX_DATA,c.getString(ContactMethodsQuery.AUX_DATA));
  bindString(insert,PostalInsert.TYPE,c.getString(ContactMethodsQuery.TYPE));
  bindString(insert,PostalInsert.LABEL,c.getString(ContactMethodsQuery.LABEL));
  insert(insert);
}

Fixed version (ground truth):
private void insertPostal(Cursor c,SQLiteStatement insert){
  long personId=c.getLong(ContactMethodsQuery.PERSON);
  insert.bindLong(PostalInsert.RAW_CONTACT_ID,personId);
  insert.bindLong(PostalInsert.MIMETYPE_ID,mPostalMimetypeId);
  bindString(insert,PostalInsert.IS_PRIMARY,c.getString(ContactMethodsQuery.ISPRIMARY));
  bindString(insert,PostalInsert.IS_SUPER_PRIMARY,c.getString(ContactMethodsQuery.ISPRIMARY));
  bindString(insert,PostalInsert.DATA,c.getString(ContactMethodsQuery.DATA));
  bindString(insert,PostalInsert.AUX_DATA,c.getString(ContactMethodsQuery.AUX_DATA));
  bindString(insert,PostalInsert.TYPE,c.getString(ContactMethodsQuery.TYPE));
  bindString(insert,PostalInsert.LABEL,c.getString(ContactMethodsQuery.LABEL));
  insert(insert);
}
Program: 152487
Project: 152487
Buggy source:
private void insertPhone(Cursor c,SQLiteStatement phoneInsert,SQLiteStatement phoneLookupInsert,SQLiteStatement hasPhoneUpdate){
  long lastUpdatedContact=-1;
  long id=c.getLong(PhonesQuery.PERSON);
  String number=c.getString(PhonesQuery.NUMBER);
  String normalizedNumber=null;
  if (number != null) {
    normalizedNumber=PhoneNumberUtils.getStrippedReversed(number);
  }
  phoneInsert.bindLong(PhoneInsert.RAW_CONTACT_ID,id);
  phoneInsert.bindLong(PhoneInsert.MIMETYPE_ID,mPhoneMimetypeId);
  bindString(phoneInsert,PhoneInsert.IS_PRIMARY,c.getString(PhonesQuery.ISPRIMARY));
  bindString(phoneInsert,PhoneInsert.NUMBER,number);
  bindString(phoneInsert,PhoneInsert.TYPE,c.getString(PhonesQuery.TYPE));
  bindString(phoneInsert,PhoneInsert.LABEL,c.getString(PhonesQuery.LABEL));
  bindString(phoneInsert,PhoneInsert.NORMALIZED_NUMBER,normalizedNumber);
  long dataId=insert(phoneInsert);
  if (normalizedNumber != null) {
    phoneLookupInsert.bindLong(PhoneLookupInsert.RAW_CONTACT_ID,id);
    phoneLookupInsert.bindLong(PhoneLookupInsert.DATA_ID,dataId);
    phoneLookupInsert.bindString(PhoneLookupInsert.NORMALIZED_NUMBER,normalizedNumber);
    phoneLookupInsert.bindString(PhoneLookupInsert.MIN_MATCH,PhoneNumberUtils.toCallerIDMinMatch(number));
    insert(phoneLookupInsert);
    if (lastUpdatedContact != id) {
      lastUpdatedContact=id;
      hasPhoneUpdate.bindLong(HasPhoneNumberUpdate.CONTACT_ID,id);
      hasPhoneUpdate.execute();
    }
  }
}

Fixed version (ground truth):
private void insertPhone(Cursor c,SQLiteStatement phoneInsert,SQLiteStatement phoneLookupInsert,SQLiteStatement hasPhoneUpdate){
  long lastUpdatedContact=-1;
  long id=c.getLong(PhonesQuery.PERSON);
  String number=c.getString(PhonesQuery.NUMBER);
  String normalizedNumber=null;
  if (number != null) {
    normalizedNumber=PhoneNumberUtils.getStrippedReversed(number);
  }
  phoneInsert.bindLong(PhoneInsert.RAW_CONTACT_ID,id);
  phoneInsert.bindLong(PhoneInsert.MIMETYPE_ID,mPhoneMimetypeId);
  bindString(phoneInsert,PhoneInsert.IS_PRIMARY,c.getString(PhonesQuery.ISPRIMARY));
  bindString(phoneInsert,PhoneInsert.IS_SUPER_PRIMARY,c.getString(PhonesQuery.ISPRIMARY));
  bindString(phoneInsert,PhoneInsert.NUMBER,number);
  bindString(phoneInsert,PhoneInsert.TYPE,c.getString(PhonesQuery.TYPE));
  bindString(phoneInsert,PhoneInsert.LABEL,c.getString(PhonesQuery.LABEL));
  bindString(phoneInsert,PhoneInsert.NORMALIZED_NUMBER,normalizedNumber);
  long dataId=insert(phoneInsert);
  if (normalizedNumber != null) {
    phoneLookupInsert.bindLong(PhoneLookupInsert.RAW_CONTACT_ID,id);
    phoneLookupInsert.bindLong(PhoneLookupInsert.DATA_ID,dataId);
    phoneLookupInsert.bindString(PhoneLookupInsert.NORMALIZED_NUMBER,normalizedNumber);
    phoneLookupInsert.bindString(PhoneLookupInsert.MIN_MATCH,PhoneNumberUtils.toCallerIDMinMatch(number));
    insert(phoneLookupInsert);
    if (lastUpdatedContact != id) {
      lastUpdatedContact=id;
      hasPhoneUpdate.bindLong(HasPhoneNumberUpdate.CONTACT_ID,id);
      hasPhoneUpdate.execute();
    }
  }
}
Program: 152488
Project: 152488
Buggy source:
private void insertIm(Cursor c,SQLiteStatement insert){
  long personId=c.getLong(ContactMethodsQuery.PERSON);
  insert.bindLong(ImInsert.RAW_CONTACT_ID,personId);
  insert.bindLong(ImInsert.MIMETYPE_ID,mImMimetypeId);
  bindString(insert,ImInsert.IS_PRIMARY,c.getString(ContactMethodsQuery.ISPRIMARY));
  bindString(insert,ImInsert.DATA,c.getString(ContactMethodsQuery.DATA));
  bindString(insert,ImInsert.AUX_DATA,c.getString(ContactMethodsQuery.AUX_DATA));
  bindString(insert,ImInsert.TYPE,c.getString(ContactMethodsQuery.TYPE));
  bindString(insert,ImInsert.LABEL,c.getString(ContactMethodsQuery.LABEL));
  insert(insert);
}

Fixed version (ground truth):
private void insertIm(Cursor c,SQLiteStatement insert){
  long personId=c.getLong(ContactMethodsQuery.PERSON);
  insert.bindLong(ImInsert.RAW_CONTACT_ID,personId);
  insert.bindLong(ImInsert.MIMETYPE_ID,mImMimetypeId);
  bindString(insert,ImInsert.IS_PRIMARY,c.getString(ContactMethodsQuery.ISPRIMARY));
  bindString(insert,ImInsert.IS_SUPER_PRIMARY,c.getString(ContactMethodsQuery.ISPRIMARY));
  bindString(insert,ImInsert.DATA,c.getString(ContactMethodsQuery.DATA));
  bindString(insert,ImInsert.AUX_DATA,c.getString(ContactMethodsQuery.AUX_DATA));
  bindString(insert,ImInsert.TYPE,c.getString(ContactMethodsQuery.TYPE));
  bindString(insert,ImInsert.LABEL,c.getString(ContactMethodsQuery.LABEL));
  insert(insert);
}
Program: 152489
Project: 152489
Buggy source:
private void appendRawContactsByNormalizedNameFilter(StringBuilder sb,String normalizedName,boolean allowEmailMatch){
  sb.append("String_Node_Str" + "String_Node_Str" + NameLookupColumns.RAW_CONTACT_ID + "String_Node_Str"+ Tables.NAME_LOOKUP+ "String_Node_Str"+ NameLookupColumns.NORMALIZED_NAME+ "String_Node_Str");
  sb.append(normalizedName);
  sb.append("String_Node_Str" + NameLookupColumns.NAME_TYPE + "String_Node_Str"+ NameLookupType.NAME_COLLATION_KEY+ "String_Node_Str"+ NameLookupType.NICKNAME+ "String_Node_Str"+ NameLookupType.NAME_SHORTHAND+ "String_Node_Str"+ NameLookupType.ORGANIZATION+ "String_Node_Str"+ NameLookupType.NAME_CONSONANTS+ "String_Node_Str");
  if (allowEmailMatch) {
    sb.append("String_Node_Str" + NameLookupType.EMAIL_BASED_NICKNAME);
  }
  sb.append("String_Node_Str");
}

Fixed version (ground truth):
private void appendRawContactsByNormalizedNameFilter(StringBuilder sb,String normalizedName,boolean allowEmailMatch){
  sb.append("String_Node_Str" + "String_Node_Str" + NameLookupColumns.RAW_CONTACT_ID + "String_Node_Str"+ Tables.NAME_LOOKUP+ "String_Node_Str"+ NameLookupColumns.NORMALIZED_NAME+ "String_Node_Str");
  sb.append(normalizedName);
  sb.append("String_Node_Str" + NameLookupColumns.NAME_TYPE + "String_Node_Str"+ NameLookupType.NAME_COLLATION_KEY+ "String_Node_Str"+ NameLookupType.NICKNAME+ "String_Node_Str"+ NameLookupType.NAME_SHORTHAND+ "String_Node_Str"+ NameLookupType.ORGANIZATION+ "String_Node_Str"+ NameLookupType.NAME_CONSONANTS);
  if (allowEmailMatch) {
    sb.append("String_Node_Str" + NameLookupType.EMAIL_BASED_NICKNAME);
  }
  sb.append("String_Node_Str");
}
Program: 152493
Project: 152493
Buggy source:
public void insertNameLookupForStructuredName(long rawContactId,long dataId,String name){
  mNameLookupBuilder.insertNameLookup(rawContactId,dataId,name);
}

Fixed version (ground truth):
public void insertNameLookupForStructuredName(long rawContactId,long dataId,String name){
  mNameLookupBuilder.insertNameLookup(rawContactId,dataId,name);
  if (!TextUtils.isEmpty(name)) {
    Iterator<String> it=ContactLocaleUtils.getNameLookupKeys(name,FullNameStyle.CHINESE);
    if (it != null) {
      while (it.hasNext()) {
        String key=it.next();
        mNameLookupBuilder.insertNameLookup(rawContactId,dataId,NameLookupType.NAME_SHORTHAND,mNameLookupBuilder.normalizeName(key));
      }
    }
  }
}
Program: 152494
Project: 152494
Buggy source:
private void appendRawContactsByNormalizedNameFilter(StringBuilder sb,String normalizedName,boolean allowEmailMatch){
  sb.append("String_Node_Str" + "String_Node_Str" + NameLookupColumns.RAW_CONTACT_ID + "String_Node_Str"+ Tables.NAME_LOOKUP+ "String_Node_Str"+ NameLookupColumns.NORMALIZED_NAME+ "String_Node_Str");
  sb.append(normalizedName);
  sb.append("String_Node_Str" + NameLookupColumns.NAME_TYPE + "String_Node_Str"+ NameLookupType.NAME_COLLATION_KEY+ "String_Node_Str"+ NameLookupType.NICKNAME+ "String_Node_Str"+ NameLookupType.ORGANIZATION);
  if (allowEmailMatch) {
    sb.append("String_Node_Str" + NameLookupType.EMAIL_BASED_NICKNAME);
  }
  sb.append("String_Node_Str");
}

Fixed version (ground truth):
private void appendRawContactsByNormalizedNameFilter(StringBuilder sb,String normalizedName,boolean allowEmailMatch){
  sb.append("String_Node_Str" + "String_Node_Str" + NameLookupColumns.RAW_CONTACT_ID + "String_Node_Str"+ Tables.NAME_LOOKUP+ "String_Node_Str"+ NameLookupColumns.NORMALIZED_NAME+ "String_Node_Str");
  sb.append(normalizedName);
  sb.append("String_Node_Str" + NameLookupColumns.NAME_TYPE + "String_Node_Str"+ NameLookupType.NAME_COLLATION_KEY+ "String_Node_Str"+ NameLookupType.NICKNAME+ "String_Node_Str"+ NameLookupType.NAME_SHORTHAND+ "String_Node_Str"+ NameLookupType.ORGANIZATION);
  if (allowEmailMatch) {
    sb.append("String_Node_Str" + NameLookupType.EMAIL_BASED_NICKNAME);
  }
  sb.append("String_Node_Str");
}
Program: 152496
Project: 152496
Buggy source:
public void appendContactFilterAsNestedQuery(StringBuilder sb,String filterParam){
  sb.append("String_Node_Str" + "String_Node_Str" + RawContacts.CONTACT_ID + "String_Node_Str"+ Tables.RAW_CONTACTS+ "String_Node_Str"+ Tables.NAME_LOOKUP+ "String_Node_Str"+ RawContactsColumns.CONCRETE_ID+ "String_Node_Str"+ NameLookupColumns.RAW_CONTACT_ID+ "String_Node_Str"+ "String_Node_Str");
  sb.append(NameNormalizer.normalize(filterParam));
  sb.append("String_Node_Str" + NameLookupColumns.NAME_TYPE + "String_Node_Str"+ NameLookupType.NAME_COLLATION_KEY+ "String_Node_Str"+ NameLookupType.EMAIL_BASED_NICKNAME+ "String_Node_Str"+ NameLookupType.NICKNAME+ "String_Node_Str"+ NameLookupType.ORGANIZATION+ "String_Node_Str");
}

Fixed version (ground truth):
public void appendContactFilterAsNestedQuery(StringBuilder sb,String filterParam){
  sb.append("String_Node_Str" + "String_Node_Str" + RawContacts.CONTACT_ID + "String_Node_Str"+ Tables.RAW_CONTACTS+ "String_Node_Str"+ Tables.NAME_LOOKUP+ "String_Node_Str"+ RawContactsColumns.CONCRETE_ID+ "String_Node_Str"+ NameLookupColumns.RAW_CONTACT_ID+ "String_Node_Str"+ "String_Node_Str");
  sb.append(NameNormalizer.normalize(filterParam));
  sb.append("String_Node_Str" + NameLookupColumns.NAME_TYPE + "String_Node_Str"+ NameLookupType.NAME_COLLATION_KEY+ "String_Node_Str"+ NameLookupType.EMAIL_BASED_NICKNAME+ "String_Node_Str"+ NameLookupType.NICKNAME+ "String_Node_Str"+ NameLookupType.NAME_SHORTHAND+ "String_Node_Str"+ NameLookupType.ORGANIZATION+ "String_Node_Str");
}
Program: 152497
Project: 152497
Buggy source:
/** 
 * Parses the supplied display name, but only if the incoming values do not already contain structured name parts. Also, if the display name is not provided, generate one by concatenating first name and last name.
 */
private void fixStructuredNameComponents(ContentValues augmented,ContentValues update){
  final String unstruct=update.getAsString(StructuredName.DISPLAY_NAME);
  final boolean touchedUnstruct=!TextUtils.isEmpty(unstruct);
  final boolean touchedStruct=!areAllEmpty(update,STRUCTURED_FIELDS);
  if (touchedUnstruct && !touchedStruct) {
    NameSplitter.Name name=new NameSplitter.Name();
    mSplitter.split(name,unstruct);
    name.toValues(update);
  }
 else   if (!touchedUnstruct && (touchedStruct || areAnySpecified(update,STRUCTURED_FIELDS))) {
    NameSplitter.Name name=new NameSplitter.Name();
    name.fromValues(augmented);
    if (name.fullNameStyle == FullNameStyle.UNDEFINED) {
      mSplitter.guessNameStyle(name);
    }
    final String joined=mSplitter.join(name,true);
    update.put(StructuredName.DISPLAY_NAME,joined);
    update.put(StructuredName.FULL_NAME_STYLE,name.fullNameStyle);
    update.put(StructuredName.PHONETIC_NAME_STYLE,name.phoneticNameStyle);
  }
}

Fixed version (ground truth):
/** 
 * Parses the supplied display name, but only if the incoming values do not already contain structured name parts. Also, if the display name is not provided, generate one by concatenating first name and last name.
 */
private void fixStructuredNameComponents(ContentValues augmented,ContentValues update){
  final String unstruct=update.getAsString(StructuredName.DISPLAY_NAME);
  final boolean touchedUnstruct=!TextUtils.isEmpty(unstruct);
  final boolean touchedStruct=!areAllEmpty(update,STRUCTURED_FIELDS);
  if (touchedUnstruct && !touchedStruct) {
    NameSplitter.Name name=new NameSplitter.Name();
    mSplitter.split(name,unstruct);
    name.toValues(update);
  }
 else   if (!touchedUnstruct && (touchedStruct || areAnySpecified(update,STRUCTURED_FIELDS))) {
    NameSplitter.Name name=new NameSplitter.Name();
    name.fromValues(augmented);
    name.fullNameStyle=FullNameStyle.UNDEFINED;
    mSplitter.guessNameStyle(name);
    final String joined=mSplitter.join(name,true);
    update.put(StructuredName.DISPLAY_NAME,joined);
    update.put(StructuredName.FULL_NAME_STYLE,name.fullNameStyle);
    update.put(StructuredName.PHONETIC_NAME_STYLE,name.phoneticNameStyle);
  }
 else   if (touchedUnstruct && touchedStruct) {
    if (TextUtils.isEmpty(update.getAsString(StructuredName.FULL_NAME_STYLE))) {
      update.put(StructuredName.FULL_NAME_STYLE,mSplitter.guessFullNameStyle(unstruct));
    }
    if (TextUtils.isEmpty(update.getAsString(StructuredName.PHONETIC_NAME_STYLE))) {
      update.put(StructuredName.PHONETIC_NAME_STYLE,mSplitter.guessPhoneticNameStyle(unstruct));
    }
  }
}
Program: 152498
Project: 152498
Buggy source:
/** 
 * Makes the best guess at the expected full name style based on the character set used in the supplied name.  If the phonetic name is also supplied, tries to differentiate between Chinese, Japanese and Korean based on the alphabet used for the phonetic name.
 */
public void guessNameStyle(Name name){
  guessFullNameStyle(name);
  guessPhoneticNameStyle(name);
  name.fullNameStyle=getAdjustedNameStyleBasedOnPhoneticNameStyle(name.fullNameStyle,name.phoneticNameStyle);
}

Fixed version (ground truth):
/** 
 * Makes the best guess at the expected full name style based on the character set used in the supplied name.  If the phonetic name is also supplied, tries to differentiate between Chinese, Japanese and Korean based on the alphabet used for the phonetic name.
 */
public void guessNameStyle(Name name){
  guessFullNameStyle(name);
  if (FullNameStyle.CJK == name.fullNameStyle) {
    name.fullNameStyle=getAdjustedFullNameStyle(name.fullNameStyle);
  }
  guessPhoneticNameStyle(name);
  name.fullNameStyle=getAdjustedNameStyleBasedOnPhoneticNameStyle(name.fullNameStyle,name.phoneticNameStyle);
}
Program: 152499
Project: 152499
Buggy source:
public int guessFullNameStyle(String name){
  if (name == null) {
    return FullNameStyle.UNDEFINED;
  }
  int nameStyle=FullNameStyle.UNDEFINED;
  int length=name.length();
  int offset=0;
  while (offset < length) {
    int codePoint=Character.codePointAt(name,offset);
    if (Character.isLetter(codePoint)) {
      UnicodeBlock unicodeBlock=UnicodeBlock.of(codePoint);
      if (isLatinUnicodeBlock(unicodeBlock)) {
        return FullNameStyle.WESTERN;
      }
      if (isCJKUnicodeBlock(unicodeBlock)) {
        return guessCJKNameStyle(name,offset + Character.charCount(codePoint));
      }
      if (isJapanesePhoneticUnicodeBlock(unicodeBlock)) {
        return FullNameStyle.JAPANESE;
      }
      if (isKoreanUnicodeBlock(unicodeBlock)) {
        return FullNameStyle.KOREAN;
      }
      return FullNameStyle.WESTERN;
    }
    offset+=Character.charCount(codePoint);
  }
  return nameStyle;
}

Fixed version (ground truth):
public int guessFullNameStyle(String name){
  if (name == null) {
    return FullNameStyle.UNDEFINED;
  }
  int nameStyle=FullNameStyle.UNDEFINED;
  int length=name.length();
  int offset=0;
  while (offset < length) {
    int codePoint=Character.codePointAt(name,offset);
    if (Character.isLetter(codePoint)) {
      UnicodeBlock unicodeBlock=UnicodeBlock.of(codePoint);
      if (!isLatinUnicodeBlock(unicodeBlock)) {
        if (isCJKUnicodeBlock(unicodeBlock)) {
          return guessCJKNameStyle(name,offset + Character.charCount(codePoint));
        }
        if (isJapanesePhoneticUnicodeBlock(unicodeBlock)) {
          return FullNameStyle.JAPANESE;
        }
        if (isKoreanUnicodeBlock(unicodeBlock)) {
          return FullNameStyle.KOREAN;
        }
      }
      nameStyle=FullNameStyle.WESTERN;
    }
    offset+=Character.charCount(codePoint);
  }
  return nameStyle;
}
Program: 152500
Project: 152500
Buggy source:
/** 
 * Prepares the given   {@link StructuredPostal} row, building{@link StructuredPostal#FORMATTED_ADDRESS} to match the structuredvalues when missing. When structured components are missing, the unstructured value is assigned to  {@link StructuredPostal#STREET}.
 */
private void fixStructuredPostalComponents(ContentValues augmented,ContentValues update){
  final String unstruct=update.getAsString(StructuredPostal.FORMATTED_ADDRESS);
  final boolean touchedUnstruct=!TextUtils.isEmpty(unstruct);
  final boolean touchedStruct=!areAllEmpty(update,STRUCTURED_FIELDS);
  final PostalSplitter.Postal postal=new PostalSplitter.Postal();
  if (touchedUnstruct && !touchedStruct) {
    mSplitter.split(postal,unstruct);
    postal.toValues(update);
  }
 else   if (!touchedUnstruct && touchedStruct) {
    postal.fromValues(augmented);
    final String joined=mSplitter.join(postal);
    update.put(StructuredPostal.FORMATTED_ADDRESS,joined);
  }
}

Fixed version (ground truth):
/** 
 * Prepares the given   {@link StructuredPostal} row, building{@link StructuredPostal#FORMATTED_ADDRESS} to match the structuredvalues when missing. When structured components are missing, the unstructured value is assigned to  {@link StructuredPostal#STREET}.
 */
private void fixStructuredPostalComponents(ContentValues augmented,ContentValues update){
  final boolean touchedUnstruct=update.containsKey(StructuredPostal.FORMATTED_ADDRESS);
  final boolean touchedStruct=areAnySpecified(update,STRUCTURED_FIELDS);
  final PostalSplitter.Postal postal=new PostalSplitter.Postal();
  if (touchedUnstruct && !touchedStruct) {
    final String unstruct=update.getAsString(StructuredPostal.FORMATTED_ADDRESS);
    mSplitter.split(postal,unstruct);
    postal.toValues(update);
  }
 else   if (!touchedUnstruct && touchedStruct) {
    postal.fromValues(augmented);
    final String joined=mSplitter.join(postal);
    update.put(StructuredPostal.FORMATTED_ADDRESS,joined);
  }
}
Program: 152501
Project: 152501
Buggy source:
/** 
 * Parses the supplied display name, but only if the incoming values do not already contain structured name parts. Also, if the display name is not provided, generate one by concatenating first name and last name.
 */
private void fixStructuredNameComponents(ContentValues augmented,ContentValues update){
  final String unstruct=update.getAsString(StructuredName.DISPLAY_NAME);
  final boolean touchedUnstruct=!TextUtils.isEmpty(unstruct);
  final boolean touchedStruct=!areAllEmpty(update,STRUCTURED_FIELDS);
  if (touchedUnstruct && !touchedStruct) {
    NameSplitter.Name name=new NameSplitter.Name();
    mSplitter.split(name,unstruct);
    name.toValues(update);
  }
 else   if (!touchedUnstruct && touchedStruct) {
    NameSplitter.Name name=new NameSplitter.Name();
    name.fromValues(augmented);
    final String joined=mSplitter.join(name);
    update.put(StructuredName.DISPLAY_NAME,joined);
  }
}

Fixed version (ground truth):
/** 
 * Parses the supplied display name, but only if the incoming values do not already contain structured name parts. Also, if the display name is not provided, generate one by concatenating first name and last name.
 */
private void fixStructuredNameComponents(ContentValues augmented,ContentValues update){
  final boolean touchedUnstruct=update.containsKey(StructuredName.DISPLAY_NAME);
  final boolean touchedStruct=areAnySpecified(update,STRUCTURED_FIELDS);
  if (touchedUnstruct && !touchedStruct) {
    final String unstruct=update.getAsString(StructuredName.DISPLAY_NAME);
    NameSplitter.Name name=new NameSplitter.Name();
    mSplitter.split(name,unstruct);
    name.toValues(update);
  }
 else   if (!touchedUnstruct && touchedStruct) {
    NameSplitter.Name name=new NameSplitter.Name();
    name.fromValues(augmented);
    final String joined=mSplitter.join(name);
    update.put(StructuredName.DISPLAY_NAME,joined);
  }
}
Program: 152502
Project: 152502
Buggy source:
/** 
 * Prepares the given   {@link StructuredPostal} row, building{@link StructuredPostal#FORMATTED_ADDRESS} to match the structuredvalues when missing. When structured components are missing, the unstructured value is assigned to  {@link StructuredPostal#STREET}.
 */
private void fixStructuredPostalComponents(ContentValues augmented,ContentValues update){
  final boolean touchedUnstruct=update.containsKey(StructuredPostal.FORMATTED_ADDRESS);
  final boolean touchedStruct=areAnySpecified(update,STRUCTURED_FIELDS);
  final PostalSplitter.Postal postal=new PostalSplitter.Postal();
  if (touchedUnstruct && !touchedStruct) {
    final String unstruct=update.getAsString(StructuredPostal.FORMATTED_ADDRESS);
    mSplitter.split(postal,unstruct);
    postal.toValues(update);
  }
 else   if (!touchedUnstruct && touchedStruct) {
    postal.fromValues(augmented);
    final String joined=mSplitter.join(postal);
    update.put(StructuredPostal.FORMATTED_ADDRESS,joined);
  }
}

Fixed version (ground truth):
/** 
 * Prepares the given   {@link StructuredPostal} row, building{@link StructuredPostal#FORMATTED_ADDRESS} to match the structuredvalues when missing. When structured components are missing, the unstructured value is assigned to  {@link StructuredPostal#STREET}.
 */
private void fixStructuredPostalComponents(ContentValues augmented,ContentValues update){
  final String unstruct=update.getAsString(StructuredPostal.FORMATTED_ADDRESS);
  final boolean touchedUnstruct=!TextUtils.isEmpty(unstruct);
  final boolean touchedStruct=!areAllEmpty(update,STRUCTURED_FIELDS);
  final PostalSplitter.Postal postal=new PostalSplitter.Postal();
  if (touchedUnstruct && !touchedStruct) {
    mSplitter.split(postal,unstruct);
    postal.toValues(update);
  }
 else   if (!touchedUnstruct && (touchedStruct || areAnySpecified(update,STRUCTURED_FIELDS))) {
    postal.fromValues(augmented);
    final String joined=mSplitter.join(postal);
    update.put(StructuredPostal.FORMATTED_ADDRESS,joined);
  }
}
Program: 152503
Project: 152503
Buggy source:
/** 
 * Test all against   {@link TextUtils#isEmpty(CharSequence)}.
 */
private static boolean areAnySpecified(ContentValues values,String[] keys){
  for (  String key : keys) {
    if (values.containsKey(key)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Returns true if a value (possibly null) is specified for at least one of the supplied keys.
 */
private static boolean areAnySpecified(ContentValues values,String[] keys){
  for (  String key : keys) {
    if (values.containsKey(key)) {
      return true;
    }
  }
  return false;
}
Program: 152504
Project: 152504
Buggy source:
/** 
 * Parses the supplied display name, but only if the incoming values do not already contain structured name parts. Also, if the display name is not provided, generate one by concatenating first name and last name.
 */
private void fixStructuredNameComponents(ContentValues augmented,ContentValues update){
  final boolean touchedUnstruct=update.containsKey(StructuredName.DISPLAY_NAME);
  final boolean touchedStruct=areAnySpecified(update,STRUCTURED_FIELDS);
  if (touchedUnstruct && !touchedStruct) {
    final String unstruct=update.getAsString(StructuredName.DISPLAY_NAME);
    NameSplitter.Name name=new NameSplitter.Name();
    mSplitter.split(name,unstruct);
    name.toValues(update);
  }
 else   if (!touchedUnstruct && touchedStruct) {
    NameSplitter.Name name=new NameSplitter.Name();
    name.fromValues(augmented);
    final String joined=mSplitter.join(name);
    update.put(StructuredName.DISPLAY_NAME,joined);
  }
}

Fixed version (ground truth):
/** 
 * Parses the supplied display name, but only if the incoming values do not already contain structured name parts. Also, if the display name is not provided, generate one by concatenating first name and last name.
 */
private void fixStructuredNameComponents(ContentValues augmented,ContentValues update){
  final String unstruct=update.getAsString(StructuredName.DISPLAY_NAME);
  final boolean touchedUnstruct=!TextUtils.isEmpty(unstruct);
  final boolean touchedStruct=!areAllEmpty(update,STRUCTURED_FIELDS);
  if (touchedUnstruct && !touchedStruct) {
    NameSplitter.Name name=new NameSplitter.Name();
    mSplitter.split(name,unstruct);
    name.toValues(update);
  }
 else   if (!touchedUnstruct && (touchedStruct || areAnySpecified(update,STRUCTURED_FIELDS))) {
    NameSplitter.Name name=new NameSplitter.Name();
    name.fromValues(augmented);
    final String joined=mSplitter.join(name);
    update.put(StructuredName.DISPLAY_NAME,joined);
  }
}
Program: 152505
Project: 152505
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);
  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)));
}

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();
    }
    @Override public String getPackageName(){
      return "String_Node_Str";
    }
  }
;
  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: 152506
Project: 152506
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);
  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)));
}

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();
    }
    @Override public String getPackageName(){
      return "String_Node_Str";
    }
  }
;
  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: 152507
Project: 152507
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);
  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)));
}

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();
    }
    @Override public String getPackageName(){
      return "String_Node_Str";
    }
  }
;
  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: 152508
Project: 152508
Buggy source:
/** 
 * Prepares the given   {@link StructuredPostal} row, building{@link StructuredPostal#FORMATTED_ADDRESS} to match the structuredvalues when missing. When structured components are missing, the unstructured value is assigned to  {@link StructuredPostal#STREET}.
 */
private void fixStructuredPostalComponents(ContentValues augmented,ContentValues update){
  final String unstruct=update.getAsString(StructuredPostal.FORMATTED_ADDRESS);
  final boolean touchedUnstruct=!TextUtils.isEmpty(unstruct);
  final boolean touchedStruct=!areAllEmpty(update,STRUCTURED_FIELDS);
  final PostalSplitter.Postal postal=new PostalSplitter.Postal();
  if (touchedUnstruct && !touchedStruct) {
    mSplitter.split(postal,unstruct);
    postal.toValues(update);
  }
 else   if (!touchedUnstruct && touchedStruct) {
    postal.fromValues(augmented);
    final String joined=mSplitter.join(postal);
    update.put(StructuredPostal.FORMATTED_ADDRESS,joined);
  }
}

Fixed version (ground truth):
/** 
 * Prepares the given   {@link StructuredPostal} row, building{@link StructuredPostal#FORMATTED_ADDRESS} to match the structuredvalues when missing. When structured components are missing, the unstructured value is assigned to  {@link StructuredPostal#STREET}.
 */
private void fixStructuredPostalComponents(ContentValues augmented,ContentValues update){
  final boolean touchedUnstruct=update.containsKey(StructuredPostal.FORMATTED_ADDRESS);
  final boolean touchedStruct=areAnySpecified(update,STRUCTURED_FIELDS);
  final PostalSplitter.Postal postal=new PostalSplitter.Postal();
  if (touchedUnstruct && !touchedStruct) {
    final String unstruct=update.getAsString(StructuredPostal.FORMATTED_ADDRESS);
    mSplitter.split(postal,unstruct);
    postal.toValues(update);
  }
 else   if (!touchedUnstruct && touchedStruct) {
    postal.fromValues(augmented);
    final String joined=mSplitter.join(postal);
    update.put(StructuredPostal.FORMATTED_ADDRESS,joined);
  }
}
Program: 152509
Project: 152509
Buggy source:
/** 
 * Parses the supplied display name, but only if the incoming values do not already contain structured name parts. Also, if the display name is not provided, generate one by concatenating first name and last name.
 */
private void fixStructuredNameComponents(ContentValues augmented,ContentValues update){
  final String unstruct=update.getAsString(StructuredName.DISPLAY_NAME);
  final boolean touchedUnstruct=!TextUtils.isEmpty(unstruct);
  final boolean touchedStruct=!areAllEmpty(update,STRUCTURED_FIELDS);
  if (touchedUnstruct && !touchedStruct) {
    NameSplitter.Name name=new NameSplitter.Name();
    mSplitter.split(name,unstruct);
    name.toValues(update);
  }
 else   if (!touchedUnstruct && touchedStruct) {
    NameSplitter.Name name=new NameSplitter.Name();
    name.fromValues(augmented);
    final String joined=mSplitter.join(name);
    update.put(StructuredName.DISPLAY_NAME,joined);
  }
}

Fixed version (ground truth):
/** 
 * Parses the supplied display name, but only if the incoming values do not already contain structured name parts. Also, if the display name is not provided, generate one by concatenating first name and last name.
 */
private void fixStructuredNameComponents(ContentValues augmented,ContentValues update){
  final boolean touchedUnstruct=update.containsKey(StructuredName.DISPLAY_NAME);
  final boolean touchedStruct=areAnySpecified(update,STRUCTURED_FIELDS);
  if (touchedUnstruct && !touchedStruct) {
    final String unstruct=update.getAsString(StructuredName.DISPLAY_NAME);
    NameSplitter.Name name=new NameSplitter.Name();
    mSplitter.split(name,unstruct);
    name.toValues(update);
  }
 else   if (!touchedUnstruct && touchedStruct) {
    NameSplitter.Name name=new NameSplitter.Name();
    name.fromValues(augmented);
    final String joined=mSplitter.join(name);
    update.put(StructuredName.DISPLAY_NAME,joined);
  }
}
Program: 152510
Project: 152510
Buggy source:
/** 
 * Prepares the given   {@link StructuredPostal} row, building{@link StructuredPostal#FORMATTED_ADDRESS} to match the structuredvalues when missing. When structured components are missing, the unstructured value is assigned to  {@link StructuredPostal#STREET}.
 */
private void fixStructuredPostalComponents(ContentValues augmented,ContentValues update){
  final String unstruct=update.getAsString(StructuredPostal.FORMATTED_ADDRESS);
  final boolean touchedUnstruct=!TextUtils.isEmpty(unstruct);
  final boolean touchedStruct=!areAllEmpty(update,STRUCTURED_FIELDS);
  final PostalSplitter.Postal postal=new PostalSplitter.Postal();
  if (touchedUnstruct && !touchedStruct) {
    mSplitter.split(postal,unstruct);
    postal.toValues(update);
  }
 else   if (!touchedUnstruct && touchedStruct) {
    postal.fromValues(augmented);
    final String joined=mSplitter.join(postal);
    update.put(StructuredPostal.FORMATTED_ADDRESS,joined);
  }
}

Fixed version (ground truth):
/** 
 * Prepares the given   {@link StructuredPostal} row, building{@link StructuredPostal#FORMATTED_ADDRESS} to match the structuredvalues when missing. When structured components are missing, the unstructured value is assigned to  {@link StructuredPostal#STREET}.
 */
private void fixStructuredPostalComponents(ContentValues augmented,ContentValues update){
  final boolean touchedUnstruct=update.containsKey(StructuredPostal.FORMATTED_ADDRESS);
  final boolean touchedStruct=areAnySpecified(update,STRUCTURED_FIELDS);
  final PostalSplitter.Postal postal=new PostalSplitter.Postal();
  if (touchedUnstruct && !touchedStruct) {
    final String unstruct=update.getAsString(StructuredPostal.FORMATTED_ADDRESS);
    mSplitter.split(postal,unstruct);
    postal.toValues(update);
  }
 else   if (!touchedUnstruct && touchedStruct) {
    postal.fromValues(augmented);
    final String joined=mSplitter.join(postal);
    update.put(StructuredPostal.FORMATTED_ADDRESS,joined);
  }
}
Program: 152511
Project: 152511
Buggy source:
/** 
 * Parses the supplied display name, but only if the incoming values do not already contain structured name parts. Also, if the display name is not provided, generate one by concatenating first name and last name.
 */
private void fixStructuredNameComponents(ContentValues augmented,ContentValues update){
  final String unstruct=update.getAsString(StructuredName.DISPLAY_NAME);
  final boolean touchedUnstruct=!TextUtils.isEmpty(unstruct);
  final boolean touchedStruct=!areAllEmpty(update,STRUCTURED_FIELDS);
  if (touchedUnstruct && !touchedStruct) {
    NameSplitter.Name name=new NameSplitter.Name();
    mSplitter.split(name,unstruct);
    name.toValues(update);
  }
 else   if (!touchedUnstruct && touchedStruct) {
    NameSplitter.Name name=new NameSplitter.Name();
    name.fromValues(augmented);
    final String joined=mSplitter.join(name);
    update.put(StructuredName.DISPLAY_NAME,joined);
  }
}

Fixed version (ground truth):
/** 
 * Parses the supplied display name, but only if the incoming values do not already contain structured name parts. Also, if the display name is not provided, generate one by concatenating first name and last name.
 */
private void fixStructuredNameComponents(ContentValues augmented,ContentValues update){
  final boolean touchedUnstruct=update.containsKey(StructuredName.DISPLAY_NAME);
  final boolean touchedStruct=areAnySpecified(update,STRUCTURED_FIELDS);
  if (touchedUnstruct && !touchedStruct) {
    final String unstruct=update.getAsString(StructuredName.DISPLAY_NAME);
    NameSplitter.Name name=new NameSplitter.Name();
    mSplitter.split(name,unstruct);
    name.toValues(update);
  }
 else   if (!touchedUnstruct && touchedStruct) {
    NameSplitter.Name name=new NameSplitter.Name();
    name.fromValues(augmented);
    final String joined=mSplitter.join(name);
    update.put(StructuredName.DISPLAY_NAME,joined);
  }
}
Program: 152512
Project: 152512
Buggy source:
/** 
 * Prepares the given   {@link StructuredPostal} row, building{@link StructuredPostal#FORMATTED_ADDRESS} to match the structuredvalues when missing. When structured components are missing, the unstructured value is assigned to  {@link StructuredPostal#STREET}.
 */
private void fixStructuredPostalComponents(ContentValues augmented,ContentValues update){
  final String unstruct=update.getAsString(StructuredPostal.FORMATTED_ADDRESS);
  final boolean touchedUnstruct=!TextUtils.isEmpty(unstruct);
  final boolean touchedStruct=!areAllEmpty(update,STRUCTURED_FIELDS);
  final PostalSplitter.Postal postal=new PostalSplitter.Postal();
  if (touchedUnstruct && !touchedStruct) {
    mSplitter.split(postal,unstruct);
    postal.toValues(update);
  }
 else   if (!touchedUnstruct && touchedStruct) {
    postal.fromValues(augmented);
    final String joined=mSplitter.join(postal);
    update.put(StructuredPostal.FORMATTED_ADDRESS,joined);
  }
}

Fixed version (ground truth):
/** 
 * Prepares the given   {@link StructuredPostal} row, building{@link StructuredPostal#FORMATTED_ADDRESS} to match the structuredvalues when missing. When structured components are missing, the unstructured value is assigned to  {@link StructuredPostal#STREET}.
 */
private void fixStructuredPostalComponents(ContentValues augmented,ContentValues update){
  final boolean touchedUnstruct=update.containsKey(StructuredPostal.FORMATTED_ADDRESS);
  final boolean touchedStruct=areAnySpecified(update,STRUCTURED_FIELDS);
  final PostalSplitter.Postal postal=new PostalSplitter.Postal();
  if (touchedUnstruct && !touchedStruct) {
    final String unstruct=update.getAsString(StructuredPostal.FORMATTED_ADDRESS);
    mSplitter.split(postal,unstruct);
    postal.toValues(update);
  }
 else   if (!touchedUnstruct && touchedStruct) {
    postal.fromValues(augmented);
    final String joined=mSplitter.join(postal);
    update.put(StructuredPostal.FORMATTED_ADDRESS,joined);
  }
}
Program: 152513
Project: 152513
Buggy source:
/** 
 * Parses the supplied display name, but only if the incoming values do not already contain structured name parts. Also, if the display name is not provided, generate one by concatenating first name and last name.
 */
private void fixStructuredNameComponents(ContentValues augmented,ContentValues update){
  final String unstruct=update.getAsString(StructuredName.DISPLAY_NAME);
  final boolean touchedUnstruct=!TextUtils.isEmpty(unstruct);
  final boolean touchedStruct=!areAllEmpty(update,STRUCTURED_FIELDS);
  if (touchedUnstruct && !touchedStruct) {
    NameSplitter.Name name=new NameSplitter.Name();
    mSplitter.split(name,unstruct);
    name.toValues(update);
  }
 else   if (!touchedUnstruct && touchedStruct) {
    NameSplitter.Name name=new NameSplitter.Name();
    name.fromValues(augmented);
    final String joined=mSplitter.join(name);
    update.put(StructuredName.DISPLAY_NAME,joined);
  }
}

Fixed version (ground truth):
/** 
 * Parses the supplied display name, but only if the incoming values do not already contain structured name parts. Also, if the display name is not provided, generate one by concatenating first name and last name.
 */
private void fixStructuredNameComponents(ContentValues augmented,ContentValues update){
  final boolean touchedUnstruct=update.containsKey(StructuredName.DISPLAY_NAME);
  final boolean touchedStruct=areAnySpecified(update,STRUCTURED_FIELDS);
  if (touchedUnstruct && !touchedStruct) {
    final String unstruct=update.getAsString(StructuredName.DISPLAY_NAME);
    NameSplitter.Name name=new NameSplitter.Name();
    mSplitter.split(name,unstruct);
    name.toValues(update);
  }
 else   if (!touchedUnstruct && touchedStruct) {
    NameSplitter.Name name=new NameSplitter.Name();
    name.fromValues(augmented);
    final String joined=mSplitter.join(name);
    update.put(StructuredName.DISPLAY_NAME,joined);
  }
}