nus-yam/ex-repair huggingface dataset:
Program: 7335
Project: 7335
Buggy source:
String[] getProjectionForQuery(){
switch (mMode) {
case MODE_JOIN_CONTACT:
case MODE_STREQUENT:
case MODE_FREQUENT:
case MODE_STARRED:
case MODE_QUERY:
case MODE_DEFAULT:
case MODE_INSERT_OR_EDIT_CONTACT:
case MODE_GROUP:
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
{
      return CONTACTS_SUMMARY_PROJECTION;
    }
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
    return LEGACY_PEOPLE_PROJECTION;
  }
case MODE_PICK_PHONE:
{
  return PHONES_PROJECTION;
}
case MODE_LEGACY_PICK_PHONE:
{
return LEGACY_PHONES_PROJECTION;
}
case MODE_PICK_POSTAL:
{
return POSTALS_PROJECTION;
}
case MODE_LEGACY_PICK_POSTAL:
{
return LEGACY_POSTALS_PROJECTION;
}
case MODE_QUERY_PICK_TO_VIEW:
{
if (mQueryMode == QUERY_MODE_MAILTO) {
return CONTACTS_SUMMARY_PROJECTION;
}
 else if (mQueryMode == QUERY_MODE_TEL) {
return PHONES_PROJECTION;
}
break;
}
}
return CONTACTS_SUMMARY_PROJECTION;
}

Fixed version (ground truth):
String[] getProjectionForQuery(){
switch (mMode) {
case MODE_JOIN_CONTACT:
case MODE_STREQUENT:
case MODE_FREQUENT:
case MODE_STARRED:
case MODE_QUERY:
case MODE_DEFAULT:
case MODE_INSERT_OR_EDIT_CONTACT:
case MODE_GROUP:
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
{
      return CONTACTS_SUMMARY_PROJECTION;
    }
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
    return LEGACY_PEOPLE_PROJECTION;
  }
case MODE_PICK_PHONE:
{
  return PHONES_PROJECTION;
}
case MODE_LEGACY_PICK_PHONE:
{
return LEGACY_PHONES_PROJECTION;
}
case MODE_PICK_POSTAL:
{
return POSTALS_PROJECTION;
}
case MODE_LEGACY_PICK_POSTAL:
{
return LEGACY_POSTALS_PROJECTION;
}
case MODE_QUERY_PICK_TO_VIEW:
{
if (mQueryMode == QUERY_MODE_MAILTO) {
return CONTACTS_SUMMARY_PROJECTION_FROM_EMAIL;
}
 else if (mQueryMode == QUERY_MODE_TEL) {
return PHONES_PROJECTION;
}
break;
}
}
return CONTACTS_SUMMARY_PROJECTION;
}
Program: 7336
Project: 7336
Buggy source:
Uri getUriToQuery(){
switch (mMode) {
case MODE_JOIN_CONTACT:
case MODE_FREQUENT:
case MODE_STARRED:
case MODE_DEFAULT:
case MODE_INSERT_OR_EDIT_CONTACT:
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
{
      return Contacts.CONTENT_URI;
    }
case MODE_STREQUENT:
{
    return Contacts.CONTENT_STREQUENT_URI;
  }
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
  return People.CONTENT_URI;
}
case MODE_PICK_PHONE:
{
return Phone.CONTENT_URI;
}
case MODE_LEGACY_PICK_PHONE:
{
return Phones.CONTENT_URI;
}
case MODE_PICK_POSTAL:
{
return StructuredPostal.CONTENT_URI;
}
case MODE_LEGACY_PICK_POSTAL:
{
return ContactMethods.CONTENT_URI;
}
case MODE_QUERY_PICK_TO_VIEW:
{
if (mQueryMode == QUERY_MODE_MAILTO) {
return Uri.withAppendedPath(Email.CONTENT_FILTER_URI,Uri.encode(mQueryData));
}
 else if (mQueryMode == QUERY_MODE_TEL) {
return Uri.withAppendedPath(Phone.CONTENT_FILTER_URI,Uri.encode(mQueryData));
}
}
}
return null;
}

Fixed version (ground truth):
Uri getUriToQuery(){
switch (mMode) {
case MODE_JOIN_CONTACT:
    return getJoinSuggestionsUri(null);
case MODE_FREQUENT:
case MODE_STARRED:
case MODE_DEFAULT:
case MODE_INSERT_OR_EDIT_CONTACT:
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
{
    return Contacts.CONTENT_URI;
  }
case MODE_STREQUENT:
{
  return Contacts.CONTENT_STREQUENT_URI;
}
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
return People.CONTENT_URI;
}
case MODE_PICK_PHONE:
{
return Phone.CONTENT_URI;
}
case MODE_LEGACY_PICK_PHONE:
{
return Phones.CONTENT_URI;
}
case MODE_PICK_POSTAL:
{
return StructuredPostal.CONTENT_URI;
}
case MODE_LEGACY_PICK_POSTAL:
{
return ContactMethods.CONTENT_URI;
}
case MODE_QUERY_PICK_TO_VIEW:
{
if (mQueryMode == QUERY_MODE_MAILTO) {
return Uri.withAppendedPath(Email.CONTENT_FILTER_URI,Uri.encode(mQueryData));
}
 else if (mQueryMode == QUERY_MODE_TEL) {
return Uri.withAppendedPath(Phone.CONTENT_FILTER_URI,Uri.encode(mQueryData));
}
}
case MODE_QUERY:
{
return getContactFilterUri(mQueryData);
}
case MODE_GROUP:
{
return mGroupUri;
}
default :
{
throw new IllegalStateException("String_Node_Str");
}
}
}
Program: 7339
Project: 7339
Buggy source:
@Override protected void onQueryComplete(int token,Object cookie,Cursor cursor){
  final ContactsListActivity activity=mActivity.get();
  if (activity != null && !activity.isFinishing()) {
    if (cursor != null && mLoadingJoinSuggestions) {
      mLoadingJoinSuggestions=false;
      if (cursor.getCount() > 0) {
        activity.mAdapter.setSuggestionsCursor(cursor);
      }
 else {
        cursor.close();
        activity.mAdapter.setSuggestionsCursor(null);
      }
      if (activity.mAdapter.mSuggestionsCursorCount == 0 || !activity.mJoinModeShowAllContacts) {
        startQuery(QUERY_TOKEN,null,activity.getContactFilterUri(activity.mQuery),CONTACTS_SUMMARY_PROJECTION,Contacts._ID + "String_Node_Str" + activity.mQueryAggregateId+ "String_Node_Str"+ CLAUSE_ONLY_VISIBLE,null,getSortOrder(CONTACTS_SUMMARY_PROJECTION));
        return;
      }
      cursor=activity.getShowAllContactsLabelCursor(CONTACTS_SUMMARY_PROJECTION);
    }
    activity.mAdapter.setLoading(false);
    activity.getListView().clearTextFilter();
    activity.mAdapter.changeCursor(cursor);
    if (activity.mListState != null) {
      activity.mList.onRestoreInstanceState(activity.mListState);
      if (activity.mListHasFocus) {
        activity.mList.requestFocus();
      }
      activity.mListHasFocus=false;
      activity.mListState=null;
    }
  }
 else {
    cursor.close();
  }
}

Fixed version (ground truth):
@Override protected void onQueryComplete(int token,Object cookie,Cursor cursor){
  final ContactsListActivity activity=mActivity.get();
  if (activity != null && !activity.isFinishing()) {
    if (cursor != null && mLoadingJoinSuggestions) {
      mLoadingJoinSuggestions=false;
      if (cursor.getCount() > 0) {
        activity.mAdapter.setSuggestionsCursor(cursor);
      }
 else {
        cursor.close();
        activity.mAdapter.setSuggestionsCursor(null);
      }
      if (activity.mAdapter.mSuggestionsCursorCount == 0 || !activity.mJoinModeShowAllContacts) {
        startQuery(QUERY_TOKEN,null,activity.getContactFilterUri(activity.mQueryData),CONTACTS_SUMMARY_PROJECTION,Contacts._ID + "String_Node_Str" + activity.mQueryAggregateId+ "String_Node_Str"+ CLAUSE_ONLY_VISIBLE,null,getSortOrder(CONTACTS_SUMMARY_PROJECTION));
        return;
      }
      cursor=activity.getShowAllContactsLabelCursor(CONTACTS_SUMMARY_PROJECTION);
    }
    activity.mAdapter.setLoading(false);
    activity.getListView().clearTextFilter();
    activity.mAdapter.changeCursor(cursor);
    if (activity.mListState != null) {
      activity.mList.onRestoreInstanceState(activity.mListState);
      if (activity.mListHasFocus) {
        activity.mList.requestFocus();
      }
      activity.mListHasFocus=false;
      activity.mListState=null;
    }
  }
 else {
    cursor.close();
  }
}
Program: 7340
Project: 7340
Buggy source:
String[] getProjectionForQuery(){
switch (mMode) {
case MODE_JOIN_CONTACT:
case MODE_STREQUENT:
case MODE_FREQUENT:
case MODE_STARRED:
case MODE_QUERY:
case MODE_DEFAULT:
case MODE_INSERT_OR_EDIT_CONTACT:
case MODE_GROUP:
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
{
      return CONTACTS_SUMMARY_PROJECTION;
    }
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
    return LEGACY_PEOPLE_PROJECTION;
  }
case MODE_PICK_PHONE:
{
  return PHONES_PROJECTION;
}
case MODE_LEGACY_PICK_PHONE:
{
return LEGACY_PHONES_PROJECTION;
}
case MODE_PICK_POSTAL:
{
return POSTALS_PROJECTION;
}
case MODE_LEGACY_PICK_POSTAL:
{
return LEGACY_POSTALS_PROJECTION;
}
case MODE_QUERY_PICK_TO_VIEW:
{
if (mQueryMode == QUERY_MODE_MAILTO) {
return CONTACTS_SUMMARY_PROJECTION;
}
 else if (mQueryMode == QUERY_MODE_TEL) {
return PHONES_PROJECTION;
}
break;
}
}
return CONTACTS_SUMMARY_PROJECTION;
}

Fixed version (ground truth):
String[] getProjectionForQuery(){
switch (mMode) {
case MODE_JOIN_CONTACT:
case MODE_STREQUENT:
case MODE_FREQUENT:
case MODE_STARRED:
case MODE_QUERY:
case MODE_DEFAULT:
case MODE_INSERT_OR_EDIT_CONTACT:
case MODE_GROUP:
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
{
      return CONTACTS_SUMMARY_PROJECTION;
    }
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
    return LEGACY_PEOPLE_PROJECTION;
  }
case MODE_PICK_PHONE:
{
  return PHONES_PROJECTION;
}
case MODE_LEGACY_PICK_PHONE:
{
return LEGACY_PHONES_PROJECTION;
}
case MODE_PICK_POSTAL:
{
return POSTALS_PROJECTION;
}
case MODE_LEGACY_PICK_POSTAL:
{
return LEGACY_POSTALS_PROJECTION;
}
case MODE_QUERY_PICK_TO_VIEW:
{
if (mQueryMode == QUERY_MODE_MAILTO) {
return CONTACTS_SUMMARY_PROJECTION_FROM_EMAIL;
}
 else if (mQueryMode == QUERY_MODE_TEL) {
return PHONES_PROJECTION;
}
break;
}
}
return CONTACTS_SUMMARY_PROJECTION;
}
Program: 7341
Project: 7341
Buggy source:
Uri getUriToQuery(){
switch (mMode) {
case MODE_JOIN_CONTACT:
case MODE_FREQUENT:
case MODE_STARRED:
case MODE_DEFAULT:
case MODE_INSERT_OR_EDIT_CONTACT:
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
{
      return Contacts.CONTENT_URI;
    }
case MODE_STREQUENT:
{
    return Contacts.CONTENT_STREQUENT_URI;
  }
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
  return People.CONTENT_URI;
}
case MODE_PICK_PHONE:
{
return Phone.CONTENT_URI;
}
case MODE_LEGACY_PICK_PHONE:
{
return Phones.CONTENT_URI;
}
case MODE_PICK_POSTAL:
{
return StructuredPostal.CONTENT_URI;
}
case MODE_LEGACY_PICK_POSTAL:
{
return ContactMethods.CONTENT_URI;
}
case MODE_QUERY_PICK_TO_VIEW:
{
if (mQueryMode == QUERY_MODE_MAILTO) {
return Uri.withAppendedPath(Email.CONTENT_FILTER_URI,Uri.encode(mQueryData));
}
 else if (mQueryMode == QUERY_MODE_TEL) {
return Uri.withAppendedPath(Phone.CONTENT_FILTER_URI,Uri.encode(mQueryData));
}
}
}
return null;
}

Fixed version (ground truth):
Uri getUriToQuery(){
switch (mMode) {
case MODE_JOIN_CONTACT:
    return getJoinSuggestionsUri(null);
case MODE_FREQUENT:
case MODE_STARRED:
case MODE_DEFAULT:
case MODE_INSERT_OR_EDIT_CONTACT:
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
{
    return Contacts.CONTENT_URI;
  }
case MODE_STREQUENT:
{
  return Contacts.CONTENT_STREQUENT_URI;
}
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
return People.CONTENT_URI;
}
case MODE_PICK_PHONE:
{
return Phone.CONTENT_URI;
}
case MODE_LEGACY_PICK_PHONE:
{
return Phones.CONTENT_URI;
}
case MODE_PICK_POSTAL:
{
return StructuredPostal.CONTENT_URI;
}
case MODE_LEGACY_PICK_POSTAL:
{
return ContactMethods.CONTENT_URI;
}
case MODE_QUERY_PICK_TO_VIEW:
{
if (mQueryMode == QUERY_MODE_MAILTO) {
return Uri.withAppendedPath(Email.CONTENT_FILTER_URI,Uri.encode(mQueryData));
}
 else if (mQueryMode == QUERY_MODE_TEL) {
return Uri.withAppendedPath(Phone.CONTENT_FILTER_URI,Uri.encode(mQueryData));
}
}
case MODE_QUERY:
{
return getContactFilterUri(mQueryData);
}
case MODE_GROUP:
{
return mGroupUri;
}
default :
{
throw new IllegalStateException("String_Node_Str");
}
}
}
Program: 7344
Project: 7344
Buggy source:
@Override protected void onQueryComplete(int token,Object cookie,Cursor cursor){
  final ContactsListActivity activity=mActivity.get();
  if (activity != null && !activity.isFinishing()) {
    if (cursor != null && mLoadingJoinSuggestions) {
      mLoadingJoinSuggestions=false;
      if (cursor.getCount() > 0) {
        activity.mAdapter.setSuggestionsCursor(cursor);
      }
 else {
        cursor.close();
        activity.mAdapter.setSuggestionsCursor(null);
      }
      if (activity.mAdapter.mSuggestionsCursorCount == 0 || !activity.mJoinModeShowAllContacts) {
        startQuery(QUERY_TOKEN,null,activity.getContactFilterUri(activity.mQuery),CONTACTS_SUMMARY_PROJECTION,Contacts._ID + "String_Node_Str" + activity.mQueryAggregateId+ "String_Node_Str"+ CLAUSE_ONLY_VISIBLE,null,getSortOrder(CONTACTS_SUMMARY_PROJECTION));
        return;
      }
      cursor=activity.getShowAllContactsLabelCursor(CONTACTS_SUMMARY_PROJECTION);
    }
    activity.mAdapter.setLoading(false);
    activity.getListView().clearTextFilter();
    activity.mAdapter.changeCursor(cursor);
    if (activity.mListState != null) {
      activity.mList.onRestoreInstanceState(activity.mListState);
      if (activity.mListHasFocus) {
        activity.mList.requestFocus();
      }
      activity.mListHasFocus=false;
      activity.mListState=null;
    }
  }
 else {
    cursor.close();
  }
}

Fixed version (ground truth):
@Override protected void onQueryComplete(int token,Object cookie,Cursor cursor){
  final ContactsListActivity activity=mActivity.get();
  if (activity != null && !activity.isFinishing()) {
    if (cursor != null && mLoadingJoinSuggestions) {
      mLoadingJoinSuggestions=false;
      if (cursor.getCount() > 0) {
        activity.mAdapter.setSuggestionsCursor(cursor);
      }
 else {
        cursor.close();
        activity.mAdapter.setSuggestionsCursor(null);
      }
      if (activity.mAdapter.mSuggestionsCursorCount == 0 || !activity.mJoinModeShowAllContacts) {
        startQuery(QUERY_TOKEN,null,activity.getContactFilterUri(activity.mQueryData),CONTACTS_SUMMARY_PROJECTION,Contacts._ID + "String_Node_Str" + activity.mQueryAggregateId+ "String_Node_Str"+ CLAUSE_ONLY_VISIBLE,null,getSortOrder(CONTACTS_SUMMARY_PROJECTION));
        return;
      }
      cursor=activity.getShowAllContactsLabelCursor(CONTACTS_SUMMARY_PROJECTION);
    }
    activity.mAdapter.setLoading(false);
    activity.getListView().clearTextFilter();
    activity.mAdapter.changeCursor(cursor);
    if (activity.mListState != null) {
      activity.mList.onRestoreInstanceState(activity.mListState);
      if (activity.mListHasFocus) {
        activity.mList.requestFocus();
      }
      activity.mListHasFocus=false;
      activity.mListState=null;
    }
  }
 else {
    cursor.close();
  }
}
Program: 7345
Project: 7345
Buggy source:
String[] getProjectionForQuery(){
switch (mMode) {
case MODE_JOIN_CONTACT:
case MODE_STREQUENT:
case MODE_FREQUENT:
case MODE_STARRED:
case MODE_QUERY:
case MODE_DEFAULT:
case MODE_INSERT_OR_EDIT_CONTACT:
case MODE_GROUP:
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
{
      return CONTACTS_SUMMARY_PROJECTION;
    }
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
    return LEGACY_PEOPLE_PROJECTION;
  }
case MODE_PICK_PHONE:
{
  return PHONES_PROJECTION;
}
case MODE_LEGACY_PICK_PHONE:
{
return LEGACY_PHONES_PROJECTION;
}
case MODE_PICK_POSTAL:
{
return POSTALS_PROJECTION;
}
case MODE_LEGACY_PICK_POSTAL:
{
return LEGACY_POSTALS_PROJECTION;
}
case MODE_QUERY_PICK_TO_VIEW:
{
if (mQueryMode == QUERY_MODE_MAILTO) {
return CONTACTS_SUMMARY_PROJECTION;
}
 else if (mQueryMode == QUERY_MODE_TEL) {
return PHONES_PROJECTION;
}
break;
}
}
return CONTACTS_SUMMARY_PROJECTION;
}

Fixed version (ground truth):
String[] getProjectionForQuery(){
switch (mMode) {
case MODE_JOIN_CONTACT:
case MODE_STREQUENT:
case MODE_FREQUENT:
case MODE_STARRED:
case MODE_QUERY:
case MODE_DEFAULT:
case MODE_INSERT_OR_EDIT_CONTACT:
case MODE_GROUP:
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
{
      return CONTACTS_SUMMARY_PROJECTION;
    }
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
    return LEGACY_PEOPLE_PROJECTION;
  }
case MODE_PICK_PHONE:
{
  return PHONES_PROJECTION;
}
case MODE_LEGACY_PICK_PHONE:
{
return LEGACY_PHONES_PROJECTION;
}
case MODE_PICK_POSTAL:
{
return POSTALS_PROJECTION;
}
case MODE_LEGACY_PICK_POSTAL:
{
return LEGACY_POSTALS_PROJECTION;
}
case MODE_QUERY_PICK_TO_VIEW:
{
if (mQueryMode == QUERY_MODE_MAILTO) {
return CONTACTS_SUMMARY_PROJECTION_FROM_EMAIL;
}
 else if (mQueryMode == QUERY_MODE_TEL) {
return PHONES_PROJECTION;
}
break;
}
}
return CONTACTS_SUMMARY_PROJECTION;
}
Program: 7346
Project: 7346
Buggy source:
Uri getUriToQuery(){
switch (mMode) {
case MODE_JOIN_CONTACT:
case MODE_FREQUENT:
case MODE_STARRED:
case MODE_DEFAULT:
case MODE_INSERT_OR_EDIT_CONTACT:
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
{
      return Contacts.CONTENT_URI;
    }
case MODE_STREQUENT:
{
    return Contacts.CONTENT_STREQUENT_URI;
  }
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
  return People.CONTENT_URI;
}
case MODE_PICK_PHONE:
{
return Phone.CONTENT_URI;
}
case MODE_LEGACY_PICK_PHONE:
{
return Phones.CONTENT_URI;
}
case MODE_PICK_POSTAL:
{
return StructuredPostal.CONTENT_URI;
}
case MODE_LEGACY_PICK_POSTAL:
{
return ContactMethods.CONTENT_URI;
}
case MODE_QUERY_PICK_TO_VIEW:
{
if (mQueryMode == QUERY_MODE_MAILTO) {
return Uri.withAppendedPath(Email.CONTENT_FILTER_URI,Uri.encode(mQueryData));
}
 else if (mQueryMode == QUERY_MODE_TEL) {
return Uri.withAppendedPath(Phone.CONTENT_FILTER_URI,Uri.encode(mQueryData));
}
}
}
return null;
}

Fixed version (ground truth):
Uri getUriToQuery(){
switch (mMode) {
case MODE_JOIN_CONTACT:
    return getJoinSuggestionsUri(null);
case MODE_FREQUENT:
case MODE_STARRED:
case MODE_DEFAULT:
case MODE_INSERT_OR_EDIT_CONTACT:
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
{
    return Contacts.CONTENT_URI;
  }
case MODE_STREQUENT:
{
  return Contacts.CONTENT_STREQUENT_URI;
}
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
return People.CONTENT_URI;
}
case MODE_PICK_PHONE:
{
return Phone.CONTENT_URI;
}
case MODE_LEGACY_PICK_PHONE:
{
return Phones.CONTENT_URI;
}
case MODE_PICK_POSTAL:
{
return StructuredPostal.CONTENT_URI;
}
case MODE_LEGACY_PICK_POSTAL:
{
return ContactMethods.CONTENT_URI;
}
case MODE_QUERY_PICK_TO_VIEW:
{
if (mQueryMode == QUERY_MODE_MAILTO) {
return Uri.withAppendedPath(Email.CONTENT_FILTER_URI,Uri.encode(mQueryData));
}
 else if (mQueryMode == QUERY_MODE_TEL) {
return Uri.withAppendedPath(Phone.CONTENT_FILTER_URI,Uri.encode(mQueryData));
}
}
case MODE_QUERY:
{
return getContactFilterUri(mQueryData);
}
case MODE_GROUP:
{
return mGroupUri;
}
default :
{
throw new IllegalStateException("String_Node_Str");
}
}
}
Program: 7349
Project: 7349
Buggy source:
@Override protected void onQueryComplete(int token,Object cookie,Cursor cursor){
  final ContactsListActivity activity=mActivity.get();
  if (activity != null && !activity.isFinishing()) {
    if (cursor != null && mLoadingJoinSuggestions) {
      mLoadingJoinSuggestions=false;
      if (cursor.getCount() > 0) {
        activity.mAdapter.setSuggestionsCursor(cursor);
      }
 else {
        cursor.close();
        activity.mAdapter.setSuggestionsCursor(null);
      }
      if (activity.mAdapter.mSuggestionsCursorCount == 0 || !activity.mJoinModeShowAllContacts) {
        startQuery(QUERY_TOKEN,null,activity.getContactFilterUri(activity.mQuery),CONTACTS_SUMMARY_PROJECTION,Contacts._ID + "String_Node_Str" + activity.mQueryAggregateId+ "String_Node_Str"+ CLAUSE_ONLY_VISIBLE,null,getSortOrder(CONTACTS_SUMMARY_PROJECTION));
        return;
      }
      cursor=activity.getShowAllContactsLabelCursor(CONTACTS_SUMMARY_PROJECTION);
    }
    activity.mAdapter.setLoading(false);
    activity.getListView().clearTextFilter();
    activity.mAdapter.changeCursor(cursor);
    if (activity.mListState != null) {
      activity.mList.onRestoreInstanceState(activity.mListState);
      if (activity.mListHasFocus) {
        activity.mList.requestFocus();
      }
      activity.mListHasFocus=false;
      activity.mListState=null;
    }
  }
 else {
    cursor.close();
  }
}

Fixed version (ground truth):
@Override protected void onQueryComplete(int token,Object cookie,Cursor cursor){
  final ContactsListActivity activity=mActivity.get();
  if (activity != null && !activity.isFinishing()) {
    if (cursor != null && mLoadingJoinSuggestions) {
      mLoadingJoinSuggestions=false;
      if (cursor.getCount() > 0) {
        activity.mAdapter.setSuggestionsCursor(cursor);
      }
 else {
        cursor.close();
        activity.mAdapter.setSuggestionsCursor(null);
      }
      if (activity.mAdapter.mSuggestionsCursorCount == 0 || !activity.mJoinModeShowAllContacts) {
        startQuery(QUERY_TOKEN,null,activity.getContactFilterUri(activity.mQueryData),CONTACTS_SUMMARY_PROJECTION,Contacts._ID + "String_Node_Str" + activity.mQueryAggregateId+ "String_Node_Str"+ CLAUSE_ONLY_VISIBLE,null,getSortOrder(CONTACTS_SUMMARY_PROJECTION));
        return;
      }
      cursor=activity.getShowAllContactsLabelCursor(CONTACTS_SUMMARY_PROJECTION);
    }
    activity.mAdapter.setLoading(false);
    activity.getListView().clearTextFilter();
    activity.mAdapter.changeCursor(cursor);
    if (activity.mListState != null) {
      activity.mList.onRestoreInstanceState(activity.mListState);
      if (activity.mListHasFocus) {
        activity.mList.requestFocus();
      }
      activity.mListHasFocus=false;
      activity.mListState=null;
    }
  }
 else {
    cursor.close();
  }
}
Program: 7350
Project: 7350
Buggy source:
@Override public void handleMessage(Message message){
  if (ContactsListActivity.this.isFinishing()) {
    return;
  }
switch (message.what) {
case FETCH_IMAGE_MSG:
{
      final ImageView imageView=(ImageView)message.obj;
      if (imageView == null) {
        break;
      }
      final PhotoInfo info=(PhotoInfo)imageView.getTag();
      if (info == null) {
        break;
      }
      final long photoId=info.photoId;
      if (photoId == 0) {
        break;
      }
      Bitmap photo=mBitmapCache.get(photoId).get();
      if (photo == null) {
        break;
      }
synchronized (imageView) {
        final PhotoInfo updatedInfo=(PhotoInfo)imageView.getTag();
        long currentPhotoId=updatedInfo.photoId;
        if (currentPhotoId == photoId) {
          imageView.setImageBitmap(photo);
          mItemsMissingImages.remove(imageView);
        }
      }
      break;
    }
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message message){
  if (ContactsListActivity.this.isFinishing()) {
    return;
  }
switch (message.what) {
case FETCH_IMAGE_MSG:
{
      final ImageView imageView=(ImageView)message.obj;
      if (imageView == null) {
        break;
      }
      final PhotoInfo info=(PhotoInfo)imageView.getTag();
      if (info == null) {
        break;
      }
      final long photoId=info.photoId;
      if (photoId == 0) {
        break;
      }
      SoftReference<Bitmap> photoRef=mBitmapCache.get(photoId);
      if (photoRef == null) {
        break;
      }
      Bitmap photo=photoRef.get();
      if (photo == null) {
        mBitmapCache.remove(photoId);
        break;
      }
synchronized (imageView) {
        final PhotoInfo updatedInfo=(PhotoInfo)imageView.getTag();
        long currentPhotoId=updatedInfo.photoId;
        if (currentPhotoId == photoId) {
          imageView.setImageBitmap(photo);
          mItemsMissingImages.remove(imageView);
        }
      }
      break;
    }
}
}
Program: 7351
Project: 7351
Buggy source:
@Override public void handleMessage(Message message){
  if (ContactsListActivity.this.isFinishing()) {
    return;
  }
switch (message.what) {
case FETCH_IMAGE_MSG:
{
      final ImageView imageView=(ImageView)message.obj;
      if (imageView == null) {
        break;
      }
      final PhotoInfo info=(PhotoInfo)imageView.getTag();
      if (info == null) {
        break;
      }
      final long photoId=info.photoId;
      if (photoId == 0) {
        break;
      }
      Bitmap photo=mBitmapCache.get(photoId).get();
      if (photo == null) {
        break;
      }
synchronized (imageView) {
        final PhotoInfo updatedInfo=(PhotoInfo)imageView.getTag();
        long currentPhotoId=updatedInfo.photoId;
        if (currentPhotoId == photoId) {
          imageView.setImageBitmap(photo);
          mItemsMissingImages.remove(imageView);
        }
      }
      break;
    }
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message message){
  if (ContactsListActivity.this.isFinishing()) {
    return;
  }
switch (message.what) {
case FETCH_IMAGE_MSG:
{
      final ImageView imageView=(ImageView)message.obj;
      if (imageView == null) {
        break;
      }
      final PhotoInfo info=(PhotoInfo)imageView.getTag();
      if (info == null) {
        break;
      }
      final long photoId=info.photoId;
      if (photoId == 0) {
        break;
      }
      SoftReference<Bitmap> photoRef=mBitmapCache.get(photoId);
      if (photoRef == null) {
        break;
      }
      Bitmap photo=photoRef.get();
      if (photo == null) {
        mBitmapCache.remove(photoId);
        break;
      }
synchronized (imageView) {
        final PhotoInfo updatedInfo=(PhotoInfo)imageView.getTag();
        long currentPhotoId=updatedInfo.photoId;
        if (currentPhotoId == photoId) {
          imageView.setImageBitmap(photo);
          mItemsMissingImages.remove(imageView);
        }
      }
      break;
    }
}
}
Program: 7352
Project: 7352
Buggy source:
@Override public void handleMessage(Message message){
  if (ContactsListActivity.this.isFinishing()) {
    return;
  }
switch (message.what) {
case FETCH_IMAGE_MSG:
{
      final ImageView imageView=(ImageView)message.obj;
      if (imageView == null) {
        break;
      }
      final PhotoInfo info=(PhotoInfo)imageView.getTag();
      if (info == null) {
        break;
      }
      final long photoId=info.photoId;
      if (photoId == 0) {
        break;
      }
      Bitmap photo=mBitmapCache.get(photoId).get();
      if (photo == null) {
        break;
      }
synchronized (imageView) {
        final PhotoInfo updatedInfo=(PhotoInfo)imageView.getTag();
        long currentPhotoId=updatedInfo.photoId;
        if (currentPhotoId == photoId) {
          imageView.setImageBitmap(photo);
          mItemsMissingImages.remove(imageView);
        }
      }
      break;
    }
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message message){
  if (ContactsListActivity.this.isFinishing()) {
    return;
  }
switch (message.what) {
case FETCH_IMAGE_MSG:
{
      final ImageView imageView=(ImageView)message.obj;
      if (imageView == null) {
        break;
      }
      final PhotoInfo info=(PhotoInfo)imageView.getTag();
      if (info == null) {
        break;
      }
      final long photoId=info.photoId;
      if (photoId == 0) {
        break;
      }
      SoftReference<Bitmap> photoRef=mBitmapCache.get(photoId);
      if (photoRef == null) {
        break;
      }
      Bitmap photo=photoRef.get();
      if (photo == null) {
        mBitmapCache.remove(photoId);
        break;
      }
synchronized (imageView) {
        final PhotoInfo updatedInfo=(PhotoInfo)imageView.getTag();
        long currentPhotoId=updatedInfo.photoId;
        if (currentPhotoId == photoId) {
          imageView.setImageBitmap(photo);
          mItemsMissingImages.remove(imageView);
        }
      }
      break;
    }
}
}
Program: 7353
Project: 7353
Buggy source:
@Override public void handleMessage(Message message){
  if (ContactsListActivity.this.isFinishing()) {
    return;
  }
switch (message.what) {
case FETCH_IMAGE_MSG:
{
      final ImageView imageView=(ImageView)message.obj;
      if (imageView == null) {
        break;
      }
      final PhotoInfo info=(PhotoInfo)imageView.getTag();
      if (info == null) {
        break;
      }
      final long photoId=info.photoId;
      if (photoId == 0) {
        break;
      }
      Bitmap photo=mBitmapCache.get(photoId).get();
      if (photo == null) {
        break;
      }
synchronized (imageView) {
        final PhotoInfo updatedInfo=(PhotoInfo)imageView.getTag();
        long currentPhotoId=updatedInfo.photoId;
        if (currentPhotoId == photoId) {
          imageView.setImageBitmap(photo);
          mItemsMissingImages.remove(imageView);
        }
      }
      break;
    }
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message message){
  if (ContactsListActivity.this.isFinishing()) {
    return;
  }
switch (message.what) {
case FETCH_IMAGE_MSG:
{
      final ImageView imageView=(ImageView)message.obj;
      if (imageView == null) {
        break;
      }
      final PhotoInfo info=(PhotoInfo)imageView.getTag();
      if (info == null) {
        break;
      }
      final long photoId=info.photoId;
      if (photoId == 0) {
        break;
      }
      SoftReference<Bitmap> photoRef=mBitmapCache.get(photoId);
      if (photoRef == null) {
        break;
      }
      Bitmap photo=photoRef.get();
      if (photo == null) {
        mBitmapCache.remove(photoId);
        break;
      }
synchronized (imageView) {
        final PhotoInfo updatedInfo=(PhotoInfo)imageView.getTag();
        long currentPhotoId=updatedInfo.photoId;
        if (currentPhotoId == photoId) {
          imageView.setImageBitmap(photo);
          mItemsMissingImages.remove(imageView);
        }
      }
      break;
    }
}
}
Program: 7354
Project: 7354
Buggy source:
@Override protected void onRestoreInstanceState(Bundle savedInstanceState){
  mState=savedInstanceState.<EntitySet>getParcelable(KEY_EDIT_STATE);
  bindEditors();
  super.onRestoreInstanceState(savedInstanceState);
}

Fixed version (ground truth):
@Override protected void onRestoreInstanceState(Bundle savedInstanceState){
  mState=savedInstanceState.<EntitySet>getParcelable(KEY_EDIT_STATE);
  mRawContactIdRequestingPhoto=savedInstanceState.getLong(KEY_RAW_CONTACT_ID_REQUESTING_PHOTO);
  bindEditors();
  super.onRestoreInstanceState(savedInstanceState);
}
Program: 7355
Project: 7355
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void onRequest(int request){
  if (!hasValidState())   return;
switch (request) {
case EditorListener.REQUEST_PICK_PHOTO:
{
      doPickPhotoAction();
      break;
    }
case EditorListener.FIELD_CHANGED:
{
    break;
  }
}
}

Fixed version (ground truth):
public void onRequest(int request){
  if (!hasValidState())   return;
  if (request == EditorListener.REQUEST_PICK_PHOTO) {
    doPickPhotoAction(rawContactId);
  }
}
Program: 7356
Project: 7356
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (resultCode != RESULT_OK)   return;
switch (requestCode) {
case PHOTO_PICKED_WITH_DATA:
{
    }
case REQUEST_JOIN_CONTACT:
{
    if (resultCode == RESULT_OK && data != null) {
      final long contactId=ContentUris.parseId(data.getData());
      joinAggregate(contactId);
    }
  }
}
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (resultCode != RESULT_OK)   return;
switch (requestCode) {
case PHOTO_PICKED_WITH_DATA:
{
      ContactEditorView requestingEditor=null;
      if (mRawContactIdRequestingPhoto > 0) {
        for (int i=0; i < mContent.getChildCount(); i++) {
          View childView=mContent.getChildAt(i);
          if (childView instanceof ContactEditorView) {
            ContactEditorView editor=(ContactEditorView)childView;
            if (editor.getRawContactId() == mRawContactIdRequestingPhoto) {
              requestingEditor=editor;
              break;
            }
          }
        }
      }
      if (requestingEditor != null) {
        final Bitmap photo=data.getParcelableExtra("String_Node_Str");
        requestingEditor.setPhotoBitmap(photo);
        mRawContactIdRequestingPhoto=-1;
      }
 else {
      }
      break;
    }
case REQUEST_JOIN_CONTACT:
{
    if (resultCode == RESULT_OK && data != null) {
      final long contactId=ContentUris.parseId(data.getData());
      joinAggregate(contactId);
    }
  }
}
}
Program: 7357
Project: 7357
Buggy source:
/** 
 * Rebuild the editors to match our underlying   {@link #mState} object, usuallycalled once we've parsed  {@link Entity} data or have inserted a new{@link RawContacts}.
 */
protected void bindEditors(){
  if (!hasValidState())   return;
  final LayoutInflater inflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  final Sources sources=Sources.getInstance(this);
  mContent.removeAllViews();
  mEntities=new EntityDelta[mState.size()];
  int size=mState.size();
  for (int i=0; i < size; i++) {
    EntityDelta entity=mState.get(i);
    final ValuesDelta values=entity.getValues();
    if (!values.isVisible())     continue;
    final String accountType=values.getAsString(RawContacts.ACCOUNT_TYPE);
    final ContactsSource source=sources.getInflatedSource(accountType,ContactsSource.LEVEL_CONSTRAINTS);
    ContactEditorView editor=(ContactEditorView)inflater.inflate(R.layout.item_contact_editor,mContent,false);
    mContent.addView(editor);
    editor.setState(entity,source);
    mEntities[i]=entity;
  }
  mContent.setVisibility(View.VISIBLE);
}

Fixed version (ground truth):
/** 
 * Rebuild the editors to match our underlying   {@link #mState} object, usuallycalled once we've parsed  {@link Entity} data or have inserted a new{@link RawContacts}.
 */
protected void bindEditors(){
  if (!hasValidState())   return;
  final LayoutInflater inflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  final Sources sources=Sources.getInstance(this);
  mContent.removeAllViews();
  int size=mState.size();
  for (int i=0; i < size; i++) {
    EntityDelta entity=mState.get(i);
    final ValuesDelta values=entity.getValues();
    if (!values.isVisible())     continue;
    final String accountType=values.getAsString(RawContacts.ACCOUNT_TYPE);
    final ContactsSource source=sources.getInflatedSource(accountType,ContactsSource.LEVEL_CONSTRAINTS);
    final long rawContactId=values.getAsLong(RawContacts._ID);
    ContactEditorView editor=(ContactEditorView)inflater.inflate(R.layout.item_contact_editor,mContent,false);
    editor.getPhotoEditor().setEditorListener(new EditorListener(){
      public void onDeleted(      Editor editor){
      }
      public void onRequest(      int request){
        if (!hasValidState())         return;
        if (request == EditorListener.REQUEST_PICK_PHOTO) {
          doPickPhotoAction(rawContactId);
        }
      }
    }
);
    mContent.addView(editor);
    editor.setState(entity,source);
  }
  mContent.setVisibility(View.VISIBLE);
}
Program: 7358
Project: 7358
Buggy source:
/** 
 * Pick a specific photo to be added under the currently selected tab.
 */
private boolean doPickPhotoAction(){
  if (!hasValidState())   return false;
  try {
    final Intent intent=ContactsUtils.getPhotoPickIntent();
    startActivityForResult(intent,PHOTO_PICKED_WITH_DATA);
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(this,R.string.photoPickerNotFoundText,Toast.LENGTH_LONG).show();
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Pick a specific photo to be added under the currently selected tab.
 */
private boolean doPickPhotoAction(long rawContactId){
  if (!hasValidState())   return false;
  try {
    final Intent intent=ContactsUtils.getPhotoPickIntent();
    startActivityForResult(intent,PHOTO_PICKED_WITH_DATA);
    mRawContactIdRequestingPhoto=rawContactId;
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(this,R.string.photoPickerNotFoundText,Toast.LENGTH_LONG).show();
  }
  return true;
}
Program: 7359
Project: 7359
Buggy source:
@Override protected void onSaveInstanceState(Bundle outState){
  if (hasValidState()) {
    outState.putParcelable(KEY_EDIT_STATE,mState);
  }
  super.onSaveInstanceState(outState);
}

Fixed version (ground truth):
@Override protected void onSaveInstanceState(Bundle outState){
  if (hasValidState()) {
    outState.putParcelable(KEY_EDIT_STATE,mState);
  }
  outState.putLong(KEY_RAW_CONTACT_ID_REQUESTING_PHOTO,mRawContactIdRequestingPhoto);
  super.onSaveInstanceState(outState);
}
Program: 7362
Project: 7362
Buggy source:
@Override protected void onRestoreInstanceState(Bundle savedInstanceState){
  mState=savedInstanceState.<EntitySet>getParcelable(KEY_EDIT_STATE);
  bindEditors();
  super.onRestoreInstanceState(savedInstanceState);
}

Fixed version (ground truth):
@Override protected void onRestoreInstanceState(Bundle savedInstanceState){
  mState=savedInstanceState.<EntitySet>getParcelable(KEY_EDIT_STATE);
  mRawContactIdRequestingPhoto=savedInstanceState.getLong(KEY_RAW_CONTACT_ID_REQUESTING_PHOTO);
  bindEditors();
  super.onRestoreInstanceState(savedInstanceState);
}
Program: 7363
Project: 7363
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void onRequest(int request){
  if (!hasValidState())   return;
switch (request) {
case EditorListener.REQUEST_PICK_PHOTO:
{
      doPickPhotoAction();
      break;
    }
case EditorListener.FIELD_CHANGED:
{
    break;
  }
}
}

Fixed version (ground truth):
public void onRequest(int request){
  if (!hasValidState())   return;
  if (request == EditorListener.REQUEST_PICK_PHOTO) {
    doPickPhotoAction(rawContactId);
  }
}
Program: 7364
Project: 7364
Buggy source:
/** 
 * {@inheritDoc} 
 */
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (resultCode != RESULT_OK)   return;
switch (requestCode) {
case PHOTO_PICKED_WITH_DATA:
{
    }
case REQUEST_JOIN_CONTACT:
{
    if (resultCode == RESULT_OK && data != null) {
      final long contactId=ContentUris.parseId(data.getData());
      joinAggregate(contactId);
    }
  }
}
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (resultCode != RESULT_OK)   return;
switch (requestCode) {
case PHOTO_PICKED_WITH_DATA:
{
      ContactEditorView requestingEditor=null;
      if (mRawContactIdRequestingPhoto > 0) {
        for (int i=0; i < mContent.getChildCount(); i++) {
          View childView=mContent.getChildAt(i);
          if (childView instanceof ContactEditorView) {
            ContactEditorView editor=(ContactEditorView)childView;
            if (editor.getRawContactId() == mRawContactIdRequestingPhoto) {
              requestingEditor=editor;
              break;
            }
          }
        }
      }
      if (requestingEditor != null) {
        final Bitmap photo=data.getParcelableExtra("String_Node_Str");
        requestingEditor.setPhotoBitmap(photo);
        mRawContactIdRequestingPhoto=-1;
      }
 else {
      }
      break;
    }
case REQUEST_JOIN_CONTACT:
{
    if (resultCode == RESULT_OK && data != null) {
      final long contactId=ContentUris.parseId(data.getData());
      joinAggregate(contactId);
    }
  }
}
}
Program: 7365
Project: 7365
Buggy source:
/** 
 * Rebuild the editors to match our underlying   {@link #mState} object, usuallycalled once we've parsed  {@link Entity} data or have inserted a new{@link RawContacts}.
 */
protected void bindEditors(){
  if (!hasValidState())   return;
  final LayoutInflater inflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  final Sources sources=Sources.getInstance(this);
  mContent.removeAllViews();
  mEntities=new EntityDelta[mState.size()];
  int size=mState.size();
  for (int i=0; i < size; i++) {
    EntityDelta entity=mState.get(i);
    final ValuesDelta values=entity.getValues();
    if (!values.isVisible())     continue;
    final String accountType=values.getAsString(RawContacts.ACCOUNT_TYPE);
    final ContactsSource source=sources.getInflatedSource(accountType,ContactsSource.LEVEL_CONSTRAINTS);
    ContactEditorView editor=(ContactEditorView)inflater.inflate(R.layout.item_contact_editor,mContent,false);
    mContent.addView(editor);
    editor.setState(entity,source);
    mEntities[i]=entity;
  }
  mContent.setVisibility(View.VISIBLE);
}

Fixed version (ground truth):
/** 
 * Rebuild the editors to match our underlying   {@link #mState} object, usuallycalled once we've parsed  {@link Entity} data or have inserted a new{@link RawContacts}.
 */
protected void bindEditors(){
  if (!hasValidState())   return;
  final LayoutInflater inflater=(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  final Sources sources=Sources.getInstance(this);
  mContent.removeAllViews();
  int size=mState.size();
  for (int i=0; i < size; i++) {
    EntityDelta entity=mState.get(i);
    final ValuesDelta values=entity.getValues();
    if (!values.isVisible())     continue;
    final String accountType=values.getAsString(RawContacts.ACCOUNT_TYPE);
    final ContactsSource source=sources.getInflatedSource(accountType,ContactsSource.LEVEL_CONSTRAINTS);
    final long rawContactId=values.getAsLong(RawContacts._ID);
    ContactEditorView editor=(ContactEditorView)inflater.inflate(R.layout.item_contact_editor,mContent,false);
    editor.getPhotoEditor().setEditorListener(new EditorListener(){
      public void onDeleted(      Editor editor){
      }
      public void onRequest(      int request){
        if (!hasValidState())         return;
        if (request == EditorListener.REQUEST_PICK_PHOTO) {
          doPickPhotoAction(rawContactId);
        }
      }
    }
);
    mContent.addView(editor);
    editor.setState(entity,source);
  }
  mContent.setVisibility(View.VISIBLE);
}
Program: 7366
Project: 7366
Buggy source:
/** 
 * Pick a specific photo to be added under the currently selected tab.
 */
private boolean doPickPhotoAction(){
  if (!hasValidState())   return false;
  try {
    final Intent intent=ContactsUtils.getPhotoPickIntent();
    startActivityForResult(intent,PHOTO_PICKED_WITH_DATA);
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(this,R.string.photoPickerNotFoundText,Toast.LENGTH_LONG).show();
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Pick a specific photo to be added under the currently selected tab.
 */
private boolean doPickPhotoAction(long rawContactId){
  if (!hasValidState())   return false;
  try {
    final Intent intent=ContactsUtils.getPhotoPickIntent();
    startActivityForResult(intent,PHOTO_PICKED_WITH_DATA);
    mRawContactIdRequestingPhoto=rawContactId;
  }
 catch (  ActivityNotFoundException e) {
    Toast.makeText(this,R.string.photoPickerNotFoundText,Toast.LENGTH_LONG).show();
  }
  return true;
}
Program: 7367
Project: 7367
Buggy source:
@Override protected void onSaveInstanceState(Bundle outState){
  if (hasValidState()) {
    outState.putParcelable(KEY_EDIT_STATE,mState);
  }
  super.onSaveInstanceState(outState);
}

Fixed version (ground truth):
@Override protected void onSaveInstanceState(Bundle outState){
  if (hasValidState()) {
    outState.putParcelable(KEY_EDIT_STATE,mState);
  }
  outState.putLong(KEY_RAW_CONTACT_ID_REQUESTING_PHOTO,mRawContactIdRequestingPhoto);
  super.onSaveInstanceState(outState);
}
Program: 7369
Project: 7369
Buggy source:
@Override public View newView(Context context,Cursor cursor,ViewGroup parent){
  final View view=super.newView(context,cursor,parent);
  final ContactListItemCache cache=new ContactListItemCache();
  cache.header=(TextView)view.findViewById(R.id.header);
  cache.divider=view.findViewById(R.id.list_divider);
  cache.nameView=(TextView)view.findViewById(R.id.name);
  cache.callView=view.findViewById(R.id.call_view);
  cache.callButton=(ImageView)view.findViewById(R.id.call_button);
  if (cache.callButton != null) {
    cache.callButton.setOnClickListener(ContactsListActivity.this);
  }
  cache.labelView=(TextView)view.findViewById(R.id.label);
  cache.dataView=(TextView)view.findViewById(R.id.data);
  cache.presenceView=(ImageView)view.findViewById(R.id.presence);
  cache.photoView=(FasttrackBadgeWidget)view.findViewById(R.id.photo);
  cache.photoView.setExcludeMimes(new String[]{Contacts.CONTENT_ITEM_TYPE});
  cache.nonFastTrackPhotoView=(ImageView)view.findViewById(R.id.noFastTrackphoto);
  view.setTag(cache);
  return view;
}

Fixed version (ground truth):
@Override public View newView(Context context,Cursor cursor,ViewGroup parent){
  final View view=super.newView(context,cursor,parent);
  final ContactListItemCache cache=new ContactListItemCache();
  cache.header=(TextView)view.findViewById(R.id.header);
  cache.divider=view.findViewById(R.id.list_divider);
  cache.nameView=(TextView)view.findViewById(R.id.name);
  cache.callView=view.findViewById(R.id.call_view);
  cache.callButton=(ImageView)view.findViewById(R.id.call_button);
  if (cache.callButton != null) {
    cache.callButton.setOnClickListener(ContactsListActivity.this);
  }
  cache.labelView=(TextView)view.findViewById(R.id.label);
  cache.dataView=(TextView)view.findViewById(R.id.data);
  cache.presenceView=(ImageView)view.findViewById(R.id.presence);
  cache.photoView=(FasttrackBadgeWidget)view.findViewById(R.id.photo);
  if (cache.photoView != null) {
    cache.photoView.setExcludeMimes(new String[]{Contacts.CONTENT_ITEM_TYPE});
  }
  cache.nonFastTrackPhotoView=(ImageView)view.findViewById(R.id.noFastTrackphoto);
  view.setTag(cache);
  return view;
}
Program: 7370
Project: 7370
Buggy source:
@Override public View newView(Context context,Cursor cursor,ViewGroup parent){
  final View view=super.newView(context,cursor,parent);
  final ContactListItemCache cache=new ContactListItemCache();
  cache.header=(TextView)view.findViewById(R.id.header);
  cache.divider=view.findViewById(R.id.list_divider);
  cache.nameView=(TextView)view.findViewById(R.id.name);
  cache.callView=view.findViewById(R.id.call_view);
  cache.callButton=(ImageView)view.findViewById(R.id.call_button);
  if (cache.callButton != null) {
    cache.callButton.setOnClickListener(ContactsListActivity.this);
  }
  cache.labelView=(TextView)view.findViewById(R.id.label);
  cache.dataView=(TextView)view.findViewById(R.id.data);
  cache.presenceView=(ImageView)view.findViewById(R.id.presence);
  cache.photoView=(FasttrackBadgeWidget)view.findViewById(R.id.photo);
  cache.photoView.setExcludeMimes(new String[]{Contacts.CONTENT_ITEM_TYPE});
  cache.nonFastTrackPhotoView=(ImageView)view.findViewById(R.id.noFastTrackphoto);
  view.setTag(cache);
  return view;
}

Fixed version (ground truth):
@Override public View newView(Context context,Cursor cursor,ViewGroup parent){
  final View view=super.newView(context,cursor,parent);
  final ContactListItemCache cache=new ContactListItemCache();
  cache.header=(TextView)view.findViewById(R.id.header);
  cache.divider=view.findViewById(R.id.list_divider);
  cache.nameView=(TextView)view.findViewById(R.id.name);
  cache.callView=view.findViewById(R.id.call_view);
  cache.callButton=(ImageView)view.findViewById(R.id.call_button);
  if (cache.callButton != null) {
    cache.callButton.setOnClickListener(ContactsListActivity.this);
  }
  cache.labelView=(TextView)view.findViewById(R.id.label);
  cache.dataView=(TextView)view.findViewById(R.id.data);
  cache.presenceView=(ImageView)view.findViewById(R.id.presence);
  cache.photoView=(FasttrackBadgeWidget)view.findViewById(R.id.photo);
  if (cache.photoView != null) {
    cache.photoView.setExcludeMimes(new String[]{Contacts.CONTENT_ITEM_TYPE});
  }
  cache.nonFastTrackPhotoView=(ImageView)view.findViewById(R.id.noFastTrackphoto);
  view.setTag(cache);
  return view;
}
Program: 7372
Project: 7372
Buggy source:
@Override public View newView(Context context,Cursor cursor,ViewGroup parent){
  final View view=super.newView(context,cursor,parent);
  final ContactListItemCache cache=new ContactListItemCache();
  cache.header=(TextView)view.findViewById(R.id.header);
  cache.divider=view.findViewById(R.id.list_divider);
  cache.nameView=(TextView)view.findViewById(R.id.name);
  cache.callView=view.findViewById(R.id.call_view);
  cache.callButton=(ImageView)view.findViewById(R.id.call_button);
  if (cache.callButton != null) {
    cache.callButton.setOnClickListener(ContactsListActivity.this);
  }
  cache.labelView=(TextView)view.findViewById(R.id.label);
  cache.dataView=(TextView)view.findViewById(R.id.data);
  cache.presenceView=(ImageView)view.findViewById(R.id.presence);
  cache.photoView=(FasttrackBadgeWidget)view.findViewById(R.id.photo);
  cache.photoView.setExcludeMimes(new String[]{Contacts.CONTENT_ITEM_TYPE});
  cache.nonFastTrackPhotoView=(ImageView)view.findViewById(R.id.noFastTrackphoto);
  view.setTag(cache);
  return view;
}

Fixed version (ground truth):
@Override public View newView(Context context,Cursor cursor,ViewGroup parent){
  final View view=super.newView(context,cursor,parent);
  final ContactListItemCache cache=new ContactListItemCache();
  cache.header=(TextView)view.findViewById(R.id.header);
  cache.divider=view.findViewById(R.id.list_divider);
  cache.nameView=(TextView)view.findViewById(R.id.name);
  cache.callView=view.findViewById(R.id.call_view);
  cache.callButton=(ImageView)view.findViewById(R.id.call_button);
  if (cache.callButton != null) {
    cache.callButton.setOnClickListener(ContactsListActivity.this);
  }
  cache.labelView=(TextView)view.findViewById(R.id.label);
  cache.dataView=(TextView)view.findViewById(R.id.data);
  cache.presenceView=(ImageView)view.findViewById(R.id.presence);
  cache.photoView=(FasttrackBadgeWidget)view.findViewById(R.id.photo);
  if (cache.photoView != null) {
    cache.photoView.setExcludeMimes(new String[]{Contacts.CONTENT_ITEM_TYPE});
  }
  cache.nonFastTrackPhotoView=(ImageView)view.findViewById(R.id.noFastTrackphoto);
  view.setTag(cache);
  return view;
}