nus-yam/ex-repair huggingface dataset:
Program: 184025
Project: 184025
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: 184026
Project: 184026
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: 184027
Project: 184027
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: 184030
Project: 184030
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: 184031
Project: 184031
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: 184032
Project: 184032
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: 184035
Project: 184035
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: 184036
Project: 184036
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: 184037
Project: 184037
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: 184038
Project: 184038
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: 184039
Project: 184039
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: 184040
Project: 184040
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: 184041
Project: 184041
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: 184042
Project: 184042
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: 184044
Project: 184044
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: 184045
Project: 184045
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: 184046
Project: 184046
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: 184048
Project: 184048
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: 184049
Project: 184049
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: 184050
Project: 184050
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: 184051
Project: 184051
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: 184052
Project: 184052
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: 184053
Project: 184053
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: 184055
Project: 184055
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: 184056
Project: 184056
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: 184057
Project: 184057
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: 184059
Project: 184059
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: 184062
Project: 184062
Buggy source:
/** 
 * Detect if the given   {@link MotionEvent} is outside the boundaries of thiswindow, which usually means we should dismiss.
 */
protected void detectEventOutside(MotionEvent event){
  if (event.getAction() == MotionEvent.ACTION_DOWN) {
    mDecor.getHitRect(mRect);
    final int x=(int)event.getX();
    final int y=(int)event.getY();
    if (!mRect.contains(x,y)) {
      event.setAction(MotionEvent.ACTION_OUTSIDE);
    }
  }
}

Fixed version (ground truth):
/** 
 * Detect if the given   {@link MotionEvent} is outside the boundaries of thiswindow, which usually means we should dismiss.
 */
protected void detectEventOutside(MotionEvent event){
  if (event.getAction() == MotionEvent.ACTION_DOWN) {
    mDecor.getHitRect(mRect);
    mRect.top=mRect.top + mDecor.getPaddingTop();
    mRect.bottom=mRect.bottom - mDecor.getPaddingBottom();
    final int x=(int)event.getX();
    final int y=(int)event.getY();
    if (!mRect.contains(x,y)) {
      event.setAction(MotionEvent.ACTION_OUTSIDE);
    }
  }
}