nus-yam/ex-repair huggingface dataset:
Program: 184109
Project: 184109
Buggy source:
private void processMissingImageItems(AbsListView view){
  for (  ImageView iv : mItemsMissingImages) {
    int pos=(Integer)iv.getTag();
    sendFetchImageMessage(iv);
  }
}

Fixed version (ground truth):
private void processMissingImageItems(AbsListView view){
  for (  ImageView iv : mItemsMissingImages) {
    sendFetchImageMessage(iv);
  }
}
Program: 184110
Project: 184110
Buggy source:
@Override public void handleMessage(Message message){
  if (ContactsListActivity.this.isFinishing()) {
    return;
  }
switch (message.what) {
case FETCH_IMAGE_MSG:
    ImageView imageView=(ImageView)message.obj;
  int pos=(Integer)imageView.getTag();
Cursor cursor=(Cursor)getItem(pos);
if (cursor != null && !cursor.isNull(SUMMARY_PHOTO_ID_COLUMN_INDEX)) {
try {
  Bitmap photo=ContactsUtils.loadContactPhoto(mContext,cursor.getInt(SUMMARY_PHOTO_ID_COLUMN_INDEX),null);
  mBitmapCache.put(pos,new SoftReference<Bitmap>(photo));
  if (photo != null) {
    imageView.setImageBitmap(photo);
  }
}
 catch (OutOfMemoryError e) {
}
}
if (imageView.getDrawable() == null) {
imageView.setImageResource(R.drawable.ic_contact_list_picture);
}
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:
    ImageView imageView=(ImageView)message.obj;
  long photoId=(Long)imageView.getTag();
Bitmap photo=null;
try {
photo=ContactsUtils.loadContactPhoto(mContext,photoId,null);
if (photo != null) {
  mBitmapCache.put(photoId,new SoftReference<Bitmap>(photo));
  imageView.setImageBitmap(photo);
}
}
 catch (OutOfMemoryError e) {
}
mItemsMissingImages.remove(imageView);
break;
}
}
Program: 184111
Project: 184111
Buggy source:
public ContactItemListAdapter(Context context){
  super(context,R.layout.contacts_list_item,null,false);
  mHandler=new ImageFetchHandler();
  mAlphabet=context.getString(com.android.internal.R.string.fast_scroll_alphabet);
  mUnknownNameText=context.getText(android.R.string.unknownName);
  mLocalizedLabels=context.getResources().getStringArray(android.R.array.phoneTypes);
  if (mQueryMode != QUERY_MODE_NONE) {
    mDisplayAdditionalData=false;
  }
  if ((mMode & MODE_MASK_NO_DATA) == MODE_MASK_NO_DATA) {
    mDisplayAdditionalData=false;
  }
  if ((mMode & MODE_MASK_SHOW_PHOTOS) == MODE_MASK_SHOW_PHOTOS) {
    mDisplayPhotos=true;
    setViewResource(R.layout.contacts_list_item_photo);
    mBitmapCache=new SparseArray<SoftReference<Bitmap>>();
    mItemsMissingImages=new HashSet<ImageView>();
  }
  if (mMode == MODE_STREQUENT || mMode == MODE_FREQUENT) {
    mDisplaySectionHeaders=false;
  }
}

Fixed version (ground truth):
public ContactItemListAdapter(Context context){
  super(context,R.layout.contacts_list_item,null,false);
  mHandler=new ImageFetchHandler();
  mAlphabet=context.getString(com.android.internal.R.string.fast_scroll_alphabet);
  mUnknownNameText=context.getText(android.R.string.unknownName);
  mLocalizedLabels=context.getResources().getStringArray(android.R.array.phoneTypes);
  if (mQueryMode != QUERY_MODE_NONE) {
    mDisplayAdditionalData=false;
  }
  if ((mMode & MODE_MASK_NO_DATA) == MODE_MASK_NO_DATA) {
    mDisplayAdditionalData=false;
  }
  if ((mMode & MODE_MASK_SHOW_PHOTOS) == MODE_MASK_SHOW_PHOTOS) {
    mDisplayPhotos=true;
    setViewResource(R.layout.contacts_list_item_photo);
    mBitmapCache=new HashMap<Long,SoftReference<Bitmap>>();
    mItemsMissingImages=new HashSet<ImageView>();
  }
  if (mMode == MODE_STREQUENT || mMode == MODE_FREQUENT) {
    mDisplaySectionHeaders=false;
  }
}
Program: 184112
Project: 184112
Buggy source:
public CharSequence inflateUsing(Context context,ContentValues values){
  final EditType type=EntityModifier.getCurrentType(values,mKind);
  final boolean validString=(type != null && type.actionAltRes != 0);
  return validString ? context.getText(type.actionAltRes) : null;
}

Fixed version (ground truth):
public CharSequence inflateUsing(Context context,ContentValues values){
  final EditType type=EntityModifier.getCurrentType(values,mKind);
  final boolean validString=(type != null && type.actionAltRes != 0);
  CharSequence actionString;
  if (type.customColumn != null) {
    final String customLabel=values.getAsString(type.customColumn);
    actionString=String.format(context.getString(type.actionAltRes),customLabel);
  }
 else {
    actionString=context.getText(type.actionAltRes);
  }
  return validString ? actionString : null;
}
Program: 184113
Project: 184113
Buggy source:
public CharSequence inflateUsing(Context context,ContentValues values){
  final EditType type=EntityModifier.getCurrentType(values,mKind);
  final boolean validString=(type != null && type.actionAltRes != 0);
  return validString ? context.getText(type.actionAltRes) : null;
}

Fixed version (ground truth):
public CharSequence inflateUsing(Context context,ContentValues values){
  final EditType type=EntityModifier.getCurrentType(values,mKind);
  final boolean validString=(type != null && type.actionAltRes != 0);
  CharSequence actionString;
  if (type.customColumn != null) {
    final String customLabel=values.getAsString(type.customColumn);
    actionString=String.format(context.getString(type.actionAltRes),customLabel);
  }
 else {
    actionString=context.getText(type.actionAltRes);
  }
  return validString ? actionString : null;
}
Program: 184114
Project: 184114
Buggy source:
@Override protected void onResume(){
  super.onResume();
  boolean runQuery=true;
  Activity parent=getParent();
  if (mMode == MODE_DEFAULT) {
    setDefaultMode();
  }
  if (parent != null && parent instanceof DialtactsActivity) {
    String filterText=((DialtactsActivity)parent).getAndClearFilterText();
    if (filterText != null && filterText.length() > 0) {
      getListView().setFilterText(filterText);
      runQuery=false;
    }
 else     if (mJustCreated) {
      getListView().clearTextFilter();
    }
  }
  if (mJustCreated && runQuery) {
    startQuery();
  }
  mJustCreated=false;
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  mScrollState=OnScrollListener.SCROLL_STATE_IDLE;
  boolean runQuery=true;
  Activity parent=getParent();
  if (mMode == MODE_DEFAULT) {
    setDefaultMode();
  }
  if (parent != null && parent instanceof DialtactsActivity) {
    String filterText=((DialtactsActivity)parent).getAndClearFilterText();
    if (filterText != null && filterText.length() > 0) {
      getListView().setFilterText(filterText);
      runQuery=false;
    }
 else     if (mJustCreated) {
      getListView().clearTextFilter();
    }
  }
  if (mJustCreated && runQuery) {
    startQuery();
  }
  mJustCreated=false;
}
Program: 184115
Project: 184115
Buggy source:
@Override protected void onPause(){
  super.onPause();
  TelephonyManager telephonyManager=(TelephonyManager)getSystemService(TELEPHONY_SERVICE);
  telephonyManager.listen(mPhoneStateListener,PhoneStateListener.LISTEN_NONE);
synchronized (mToneGeneratorLock) {
    if (mToneGenerator != null) {
      mToneStopper.removeMessages(STOP_TONE);
      mToneGenerator.release();
      mToneGenerator=null;
    }
  }
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
  TelephonyManager telephonyManager=(TelephonyManager)getSystemService(TELEPHONY_SERVICE);
  telephonyManager.listen(mPhoneStateListener,PhoneStateListener.LISTEN_NONE);
synchronized (mToneGeneratorLock) {
    if (mToneGenerator != null) {
      mToneGenerator.release();
      mToneGenerator=null;
    }
  }
}
Program: 184116
Project: 184116
Buggy source:
/** 
 * Plays the specified tone for TONE_LENGTH_MS milliseconds. The tone is played locally, using the audio stream for phone calls. Tones are played only if the "Audible touch tones" user preference is checked, and are NOT played if the device is in silent mode.
 * @param tone a tone code from {@link ToneGenerator}
 */
void playTone(int tone){
  if (!mDTMFToneEnabled) {
    return;
  }
  AudioManager audioManager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
  int ringerMode=audioManager.getRingerMode();
  if ((ringerMode == AudioManager.RINGER_MODE_SILENT) || (ringerMode == AudioManager.RINGER_MODE_VIBRATE)) {
    return;
  }
synchronized (mToneGeneratorLock) {
    if (mToneGenerator == null) {
      Log.w(TAG,"String_Node_Str" + tone);
      return;
    }
    mToneStopper.removeMessages(STOP_TONE);
    mToneGenerator.startTone(tone);
    mToneStopper.sendEmptyMessageDelayed(STOP_TONE,TONE_LENGTH_MS);
  }
}

Fixed version (ground truth):
/** 
 * Plays the specified tone for TONE_LENGTH_MS milliseconds. The tone is played locally, using the audio stream for phone calls. Tones are played only if the "Audible touch tones" user preference is checked, and are NOT played if the device is in silent mode.
 * @param tone a tone code from {@link ToneGenerator}
 */
void playTone(int tone){
  if (!mDTMFToneEnabled) {
    return;
  }
  AudioManager audioManager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
  int ringerMode=audioManager.getRingerMode();
  if ((ringerMode == AudioManager.RINGER_MODE_SILENT) || (ringerMode == AudioManager.RINGER_MODE_VIBRATE)) {
    return;
  }
synchronized (mToneGeneratorLock) {
    if (mToneGenerator == null) {
      Log.w(TAG,"String_Node_Str" + tone);
      return;
    }
    mToneGenerator.startTone(tone,TONE_LENGTH_MS);
  }
}
Program: 184117
Project: 184117
Buggy source:
@Override protected void onResume(){
  super.onResume();
  boolean runQuery=true;
  Activity parent=getParent();
  if (mMode == MODE_DEFAULT) {
    setDefaultMode();
  }
  if (parent != null && parent instanceof DialtactsActivity) {
    String filterText=((DialtactsActivity)parent).getAndClearFilterText();
    if (filterText != null && filterText.length() > 0) {
      getListView().setFilterText(filterText);
      runQuery=false;
    }
 else     if (mJustCreated) {
      getListView().clearTextFilter();
    }
  }
  if (mJustCreated && runQuery) {
    startQuery();
  }
  mJustCreated=false;
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  mScrollState=OnScrollListener.SCROLL_STATE_IDLE;
  boolean runQuery=true;
  Activity parent=getParent();
  if (mMode == MODE_DEFAULT) {
    setDefaultMode();
  }
  if (parent != null && parent instanceof DialtactsActivity) {
    String filterText=((DialtactsActivity)parent).getAndClearFilterText();
    if (filterText != null && filterText.length() > 0) {
      getListView().setFilterText(filterText);
      runQuery=false;
    }
 else     if (mJustCreated) {
      getListView().clearTextFilter();
    }
  }
  if (mJustCreated && runQuery) {
    startQuery();
  }
  mJustCreated=false;
}
Program: 184118
Project: 184118
Buggy source:
public CharSequence inflateUsing(Context context,ContentValues values){
  final EditType type=EntityModifier.getCurrentType(values,mKind);
  final boolean validString=(type != null && type.actionAltRes != 0);
  return validString ? context.getText(type.actionAltRes) : null;
}

Fixed version (ground truth):
public CharSequence inflateUsing(Context context,ContentValues values){
  final EditType type=EntityModifier.getCurrentType(values,mKind);
  final boolean validString=(type != null && type.actionAltRes != 0);
  CharSequence actionString;
  if (type.customColumn != null) {
    final String customLabel=values.getAsString(type.customColumn);
    actionString=String.format(context.getString(type.actionAltRes),customLabel);
  }
 else {
    actionString=context.getText(type.actionAltRes);
  }
  return validString ? actionString : null;
}
Program: 184119
Project: 184119
Buggy source:
@Override protected void onPause(){
  super.onPause();
  TelephonyManager telephonyManager=(TelephonyManager)getSystemService(TELEPHONY_SERVICE);
  telephonyManager.listen(mPhoneStateListener,PhoneStateListener.LISTEN_NONE);
synchronized (mToneGeneratorLock) {
    if (mToneGenerator != null) {
      mToneStopper.removeMessages(STOP_TONE);
      mToneGenerator.release();
      mToneGenerator=null;
    }
  }
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
  TelephonyManager telephonyManager=(TelephonyManager)getSystemService(TELEPHONY_SERVICE);
  telephonyManager.listen(mPhoneStateListener,PhoneStateListener.LISTEN_NONE);
synchronized (mToneGeneratorLock) {
    if (mToneGenerator != null) {
      mToneGenerator.release();
      mToneGenerator=null;
    }
  }
}
Program: 184120
Project: 184120
Buggy source:
/** 
 * Plays the specified tone for TONE_LENGTH_MS milliseconds. The tone is played locally, using the audio stream for phone calls. Tones are played only if the "Audible touch tones" user preference is checked, and are NOT played if the device is in silent mode.
 * @param tone a tone code from {@link ToneGenerator}
 */
void playTone(int tone){
  if (!mDTMFToneEnabled) {
    return;
  }
  AudioManager audioManager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
  int ringerMode=audioManager.getRingerMode();
  if ((ringerMode == AudioManager.RINGER_MODE_SILENT) || (ringerMode == AudioManager.RINGER_MODE_VIBRATE)) {
    return;
  }
synchronized (mToneGeneratorLock) {
    if (mToneGenerator == null) {
      Log.w(TAG,"String_Node_Str" + tone);
      return;
    }
    mToneStopper.removeMessages(STOP_TONE);
    mToneGenerator.startTone(tone);
    mToneStopper.sendEmptyMessageDelayed(STOP_TONE,TONE_LENGTH_MS);
  }
}

Fixed version (ground truth):
/** 
 * Plays the specified tone for TONE_LENGTH_MS milliseconds. The tone is played locally, using the audio stream for phone calls. Tones are played only if the "Audible touch tones" user preference is checked, and are NOT played if the device is in silent mode.
 * @param tone a tone code from {@link ToneGenerator}
 */
void playTone(int tone){
  if (!mDTMFToneEnabled) {
    return;
  }
  AudioManager audioManager=(AudioManager)getSystemService(Context.AUDIO_SERVICE);
  int ringerMode=audioManager.getRingerMode();
  if ((ringerMode == AudioManager.RINGER_MODE_SILENT) || (ringerMode == AudioManager.RINGER_MODE_VIBRATE)) {
    return;
  }
synchronized (mToneGeneratorLock) {
    if (mToneGenerator == null) {
      Log.w(TAG,"String_Node_Str" + tone);
      return;
    }
    mToneGenerator.startTone(tone,TONE_LENGTH_MS);
  }
}
Program: 184121
Project: 184121
Buggy source:
@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  if ((mMode & MODE_MASK_PICKER) == MODE_MASK_PICKER) {
    return;
  }
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  ClassCastException e) {
    Log.e(TAG,"String_Node_Str",e);
    return;
  }
  Cursor cursor=(Cursor)getListAdapter().getItem(info.position);
  if (cursor == null) {
    return;
  }
  long id=info.id;
  Uri aggUri=ContentUris.withAppendedId(Contacts.CONTENT_URI,id);
  menu.setHeaderTitle(cursor.getString(SUMMARY_NAME_COLUMN_INDEX));
  menu.add(0,MENU_ITEM_VIEW_CONTACT,0,R.string.menu_viewContact).setIntent(new Intent(Intent.ACTION_VIEW,aggUri));
  int starState=cursor.getInt(SUMMARY_STARRED_COLUMN_INDEX);
  if (starState == 0) {
    menu.add(0,MENU_ITEM_TOGGLE_STAR,0,R.string.menu_addStar);
  }
 else {
    menu.add(0,MENU_ITEM_TOGGLE_STAR,0,R.string.menu_removeStar);
  }
  menu.add(0,MENU_ITEM_EDIT,0,R.string.menu_editContact).setIntent(new Intent(Intent.ACTION_EDIT,aggUri));
  menu.add(0,MENU_ITEM_DELETE,0,R.string.menu_deleteContact);
}

Fixed version (ground truth):
@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  if ((mMode & MODE_MASK_PICKER) == MODE_MASK_PICKER) {
    return;
  }
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  ClassCastException e) {
    Log.e(TAG,"String_Node_Str",e);
    return;
  }
  Cursor cursor=(Cursor)getListAdapter().getItem(info.position);
  if (cursor == null) {
    return;
  }
  long id=info.id;
  Uri contactUri=ContentUris.withAppendedId(Contacts.CONTENT_URI,id);
  long rawContactId=ContactsUtils.queryForRawContactId(getContentResolver(),id);
  Uri rawContactUri=ContentUris.withAppendedId(RawContacts.CONTENT_URI,rawContactId);
  menu.setHeaderTitle(cursor.getString(SUMMARY_NAME_COLUMN_INDEX));
  menu.add(0,MENU_ITEM_VIEW_CONTACT,0,R.string.menu_viewContact).setIntent(new Intent(Intent.ACTION_VIEW,contactUri));
  int starState=cursor.getInt(SUMMARY_STARRED_COLUMN_INDEX);
  if (starState == 0) {
    menu.add(0,MENU_ITEM_TOGGLE_STAR,0,R.string.menu_addStar);
  }
 else {
    menu.add(0,MENU_ITEM_TOGGLE_STAR,0,R.string.menu_removeStar);
  }
  menu.add(0,MENU_ITEM_EDIT,0,R.string.menu_editContact).setIntent(new Intent(Intent.ACTION_EDIT,rawContactUri));
  menu.add(0,MENU_ITEM_DELETE,0,R.string.menu_deleteContact);
}
Program: 184122
Project: 184122
Buggy source:
/** 
 * Calls the currently selected list item.
 * @return true if the call was initiated, false otherwise
 */
boolean callSelection(){
  ListView list=getListView();
  if (list.hasFocus()) {
    Cursor cursor=(Cursor)list.getSelectedItem();
    if (cursor != null) {
      long dataId=cursor.getLong(ID_COLUMN_INDEX);
      if (dataId == 0) {
        signalError();
        return false;
      }
      Uri uri=ContentUris.withAppendedId(Data.CONTENT_URI,dataId);
      Intent intent=new Intent(Intent.ACTION_CALL_PRIVILEGED,uri);
      startActivity(intent);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Calls the currently selected list item.
 * @return true if the call was initiated, false otherwise
 */
boolean callSelection(){
  ListView list=getListView();
  if (list.hasFocus()) {
    Cursor cursor=(Cursor)list.getSelectedItem();
    if (cursor != null) {
      boolean hasPhone=cursor.getInt(SUMMARY_HAS_PHONE_COLUMN_INDEX) != 0;
      if (!hasPhone) {
        signalError();
        return false;
      }
      String phone=ContactsUtils.querySuperPrimaryPhone(getContentResolver(),cursor.getLong(ID_COLUMN_INDEX));
      if (phone == null) {
        signalError();
        return false;
      }
      Intent intent=new Intent(Intent.ACTION_CALL_PRIVILEGED,Uri.fromParts("String_Node_Str",phone,null));
      startActivity(intent);
      return true;
    }
  }
  return false;
}
Program: 184123
Project: 184123
Buggy source:
@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  if ((mMode & MODE_MASK_PICKER) == MODE_MASK_PICKER) {
    return;
  }
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  ClassCastException e) {
    Log.e(TAG,"String_Node_Str",e);
    return;
  }
  Cursor cursor=(Cursor)getListAdapter().getItem(info.position);
  if (cursor == null) {
    return;
  }
  long id=info.id;
  Uri aggUri=ContentUris.withAppendedId(Contacts.CONTENT_URI,id);
  menu.setHeaderTitle(cursor.getString(SUMMARY_NAME_COLUMN_INDEX));
  menu.add(0,MENU_ITEM_VIEW_CONTACT,0,R.string.menu_viewContact).setIntent(new Intent(Intent.ACTION_VIEW,aggUri));
  int starState=cursor.getInt(SUMMARY_STARRED_COLUMN_INDEX);
  if (starState == 0) {
    menu.add(0,MENU_ITEM_TOGGLE_STAR,0,R.string.menu_addStar);
  }
 else {
    menu.add(0,MENU_ITEM_TOGGLE_STAR,0,R.string.menu_removeStar);
  }
  menu.add(0,MENU_ITEM_EDIT,0,R.string.menu_editContact).setIntent(new Intent(Intent.ACTION_EDIT,aggUri));
  menu.add(0,MENU_ITEM_DELETE,0,R.string.menu_deleteContact);
}

Fixed version (ground truth):
@Override public void onCreateContextMenu(ContextMenu menu,View view,ContextMenuInfo menuInfo){
  if ((mMode & MODE_MASK_PICKER) == MODE_MASK_PICKER) {
    return;
  }
  AdapterView.AdapterContextMenuInfo info;
  try {
    info=(AdapterView.AdapterContextMenuInfo)menuInfo;
  }
 catch (  ClassCastException e) {
    Log.e(TAG,"String_Node_Str",e);
    return;
  }
  Cursor cursor=(Cursor)getListAdapter().getItem(info.position);
  if (cursor == null) {
    return;
  }
  long id=info.id;
  Uri contactUri=ContentUris.withAppendedId(Contacts.CONTENT_URI,id);
  long rawContactId=ContactsUtils.queryForRawContactId(getContentResolver(),id);
  Uri rawContactUri=ContentUris.withAppendedId(RawContacts.CONTENT_URI,rawContactId);
  menu.setHeaderTitle(cursor.getString(SUMMARY_NAME_COLUMN_INDEX));
  menu.add(0,MENU_ITEM_VIEW_CONTACT,0,R.string.menu_viewContact).setIntent(new Intent(Intent.ACTION_VIEW,contactUri));
  int starState=cursor.getInt(SUMMARY_STARRED_COLUMN_INDEX);
  if (starState == 0) {
    menu.add(0,MENU_ITEM_TOGGLE_STAR,0,R.string.menu_addStar);
  }
 else {
    menu.add(0,MENU_ITEM_TOGGLE_STAR,0,R.string.menu_removeStar);
  }
  menu.add(0,MENU_ITEM_EDIT,0,R.string.menu_editContact).setIntent(new Intent(Intent.ACTION_EDIT,rawContactUri));
  menu.add(0,MENU_ITEM_DELETE,0,R.string.menu_deleteContact);
}
Program: 184124
Project: 184124
Buggy source:
/** 
 * Calls the currently selected list item.
 * @return true if the call was initiated, false otherwise
 */
boolean callSelection(){
  ListView list=getListView();
  if (list.hasFocus()) {
    Cursor cursor=(Cursor)list.getSelectedItem();
    if (cursor != null) {
      long dataId=cursor.getLong(ID_COLUMN_INDEX);
      if (dataId == 0) {
        signalError();
        return false;
      }
      Uri uri=ContentUris.withAppendedId(Data.CONTENT_URI,dataId);
      Intent intent=new Intent(Intent.ACTION_CALL_PRIVILEGED,uri);
      startActivity(intent);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Calls the currently selected list item.
 * @return true if the call was initiated, false otherwise
 */
boolean callSelection(){
  ListView list=getListView();
  if (list.hasFocus()) {
    Cursor cursor=(Cursor)list.getSelectedItem();
    if (cursor != null) {
      boolean hasPhone=cursor.getInt(SUMMARY_HAS_PHONE_COLUMN_INDEX) != 0;
      if (!hasPhone) {
        signalError();
        return false;
      }
      String phone=ContactsUtils.querySuperPrimaryPhone(getContentResolver(),cursor.getLong(ID_COLUMN_INDEX));
      if (phone == null) {
        signalError();
        return false;
      }
      Intent intent=new Intent(Intent.ACTION_CALL_PRIVILEGED,Uri.fromParts("String_Node_Str",phone,null));
      startActivity(intent);
      return true;
    }
  }
  return false;
}
Program: 184125
Project: 184125
Buggy source:
Uri getPickerResultUri(long id){
switch (mMode) {
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
{
      return ContentUris.withAppendedId(Contacts.CONTENT_URI,id);
    }
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
    return ContentUris.withAppendedId(People.CONTENT_URI,id);
  }
case MODE_PICK_PHONE:
{
  return ContentUris.withAppendedId(Data.CONTENT_URI,id);
}
case MODE_LEGACY_PICK_PHONE:
{
return ContentUris.withAppendedId(Phones.CONTENT_URI,id);
}
case MODE_PICK_POSTAL:
{
return ContentUris.withAppendedId(Data.CONTENT_URI,id);
}
case MODE_LEGACY_PICK_POSTAL:
{
return ContentUris.withAppendedId(ContactMethods.CONTENT_URI,id);
}
default :
{
return null;
}
}
}

Fixed version (ground truth):
Uri getPickerResultUri(long id){
switch (mMode) {
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
case MODE_JOIN_CONTACT:
{
      return ContentUris.withAppendedId(Contacts.CONTENT_URI,id);
    }
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
    return ContentUris.withAppendedId(People.CONTENT_URI,id);
  }
case MODE_PICK_PHONE:
{
  return ContentUris.withAppendedId(Data.CONTENT_URI,id);
}
case MODE_LEGACY_PICK_PHONE:
{
return ContentUris.withAppendedId(Phones.CONTENT_URI,id);
}
case MODE_PICK_POSTAL:
{
return ContentUris.withAppendedId(Data.CONTENT_URI,id);
}
case MODE_LEGACY_PICK_POSTAL:
{
return ContentUris.withAppendedId(ContactMethods.CONTENT_URI,id);
}
default :
{
return null;
}
}
}
Program: 184126
Project: 184126
Buggy source:
Uri getPickerResultUri(long id){
switch (mMode) {
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
{
      return ContentUris.withAppendedId(Contacts.CONTENT_URI,id);
    }
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
    return ContentUris.withAppendedId(People.CONTENT_URI,id);
  }
case MODE_PICK_PHONE:
{
  return ContentUris.withAppendedId(Data.CONTENT_URI,id);
}
case MODE_LEGACY_PICK_PHONE:
{
return ContentUris.withAppendedId(Phones.CONTENT_URI,id);
}
case MODE_PICK_POSTAL:
{
return ContentUris.withAppendedId(Data.CONTENT_URI,id);
}
case MODE_LEGACY_PICK_POSTAL:
{
return ContentUris.withAppendedId(ContactMethods.CONTENT_URI,id);
}
default :
{
return null;
}
}
}

Fixed version (ground truth):
Uri getPickerResultUri(long id){
switch (mMode) {
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
case MODE_JOIN_CONTACT:
{
      return ContentUris.withAppendedId(Contacts.CONTENT_URI,id);
    }
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
    return ContentUris.withAppendedId(People.CONTENT_URI,id);
  }
case MODE_PICK_PHONE:
{
  return ContentUris.withAppendedId(Data.CONTENT_URI,id);
}
case MODE_LEGACY_PICK_PHONE:
{
return ContentUris.withAppendedId(Phones.CONTENT_URI,id);
}
case MODE_PICK_POSTAL:
{
return ContentUris.withAppendedId(Data.CONTENT_URI,id);
}
case MODE_LEGACY_PICK_POSTAL:
{
return ContentUris.withAppendedId(ContactMethods.CONTENT_URI,id);
}
default :
{
return null;
}
}
}
Program: 184127
Project: 184127
Buggy source:
@Override protected void onStop(){
  super.onStop();
  mAdapter.setLoading(true);
  mAdapter.changeCursor(null);
  if (mMode == MODE_QUERY) {
    SearchManager searchManager=(SearchManager)getSystemService(Context.SEARCH_SERVICE);
    searchManager.stopSearch();
  }
}

Fixed version (ground truth):
@Override protected void onStop(){
  super.onStop();
  mAdapter.setLoading(true);
  mAdapter.changeCursor(null);
  mAdapter.clearImageFetching();
  if (mMode == MODE_QUERY) {
    SearchManager searchManager=(SearchManager)getSystemService(Context.SEARCH_SERVICE);
    searchManager.stopSearch();
  }
}
Program: 184128
Project: 184128
Buggy source:
@Override public void handleMessage(Message message){
  if (ContactsListActivity.this.isFinishing()) {
    return;
  }
switch (message.what) {
case FETCH_IMAGE_MSG:
    ImageView imageView=(ImageView)message.obj;
  int pos=(Integer)imageView.getTag();
Cursor cursor=(Cursor)getItem(pos);
if (!cursor.isNull(SUMMARY_PHOTO_ID_COLUMN_INDEX)) {
try {
  Bitmap photo=ContactsUtils.loadContactPhoto(mContext,cursor.getInt(SUMMARY_PHOTO_ID_COLUMN_INDEX),null);
  mBitmapCache.put(pos,new SoftReference<Bitmap>(photo));
  if (photo != null) {
    imageView.setImageBitmap(photo);
  }
}
 catch (OutOfMemoryError e) {
}
}
if (imageView.getDrawable() == null) {
imageView.setImageResource(R.drawable.ic_contact_list_picture);
}
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:
    ImageView imageView=(ImageView)message.obj;
  int pos=(Integer)imageView.getTag();
Cursor cursor=(Cursor)getItem(pos);
if (cursor != null && !cursor.isNull(SUMMARY_PHOTO_ID_COLUMN_INDEX)) {
try {
  Bitmap photo=ContactsUtils.loadContactPhoto(mContext,cursor.getInt(SUMMARY_PHOTO_ID_COLUMN_INDEX),null);
  mBitmapCache.put(pos,new SoftReference<Bitmap>(photo));
  if (photo != null) {
    imageView.setImageBitmap(photo);
  }
}
 catch (OutOfMemoryError e) {
}
}
if (imageView.getDrawable() == null) {
imageView.setImageResource(R.drawable.ic_contact_list_picture);
}
mItemsMissingImages.remove(imageView);
break;
}
}
Program: 184129
Project: 184129
Buggy source:
public void onScrollStateChanged(AbsListView view,int scrollState){
  mScrollState=scrollState;
  if (scrollState != OnScrollListener.SCROLL_STATE_IDLE) {
    mHandler.clearImageFecthing();
  }
 else   if (mDisplayPhotos) {
    processMissingImageItems(view);
  }
}

Fixed version (ground truth):
public void onScrollStateChanged(AbsListView view,int scrollState){
  mScrollState=scrollState;
  if (scrollState != OnScrollListener.SCROLL_STATE_IDLE) {
    clearImageFetching();
  }
 else   if (mDisplayPhotos) {
    processMissingImageItems(view);
  }
}
Program: 184130
Project: 184130
Buggy source:
@Override protected void onStop(){
  super.onStop();
  mAdapter.setLoading(true);
  mAdapter.changeCursor(null);
  if (mMode == MODE_QUERY) {
    SearchManager searchManager=(SearchManager)getSystemService(Context.SEARCH_SERVICE);
    searchManager.stopSearch();
  }
}

Fixed version (ground truth):
@Override protected void onStop(){
  super.onStop();
  mAdapter.setLoading(true);
  mAdapter.changeCursor(null);
  mAdapter.clearImageFetching();
  if (mMode == MODE_QUERY) {
    SearchManager searchManager=(SearchManager)getSystemService(Context.SEARCH_SERVICE);
    searchManager.stopSearch();
  }
}
Program: 184131
Project: 184131
Buggy source:
@Override public void handleMessage(Message message){
  if (ContactsListActivity.this.isFinishing()) {
    return;
  }
switch (message.what) {
case FETCH_IMAGE_MSG:
    ImageView imageView=(ImageView)message.obj;
  int pos=(Integer)imageView.getTag();
Cursor cursor=(Cursor)getItem(pos);
if (!cursor.isNull(SUMMARY_PHOTO_ID_COLUMN_INDEX)) {
try {
  Bitmap photo=ContactsUtils.loadContactPhoto(mContext,cursor.getInt(SUMMARY_PHOTO_ID_COLUMN_INDEX),null);
  mBitmapCache.put(pos,new SoftReference<Bitmap>(photo));
  if (photo != null) {
    imageView.setImageBitmap(photo);
  }
}
 catch (OutOfMemoryError e) {
}
}
if (imageView.getDrawable() == null) {
imageView.setImageResource(R.drawable.ic_contact_list_picture);
}
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:
    ImageView imageView=(ImageView)message.obj;
  int pos=(Integer)imageView.getTag();
Cursor cursor=(Cursor)getItem(pos);
if (cursor != null && !cursor.isNull(SUMMARY_PHOTO_ID_COLUMN_INDEX)) {
try {
  Bitmap photo=ContactsUtils.loadContactPhoto(mContext,cursor.getInt(SUMMARY_PHOTO_ID_COLUMN_INDEX),null);
  mBitmapCache.put(pos,new SoftReference<Bitmap>(photo));
  if (photo != null) {
    imageView.setImageBitmap(photo);
  }
}
 catch (OutOfMemoryError e) {
}
}
if (imageView.getDrawable() == null) {
imageView.setImageResource(R.drawable.ic_contact_list_picture);
}
mItemsMissingImages.remove(imageView);
break;
}
}
Program: 184132
Project: 184132
Buggy source:
public void onScrollStateChanged(AbsListView view,int scrollState){
  mScrollState=scrollState;
  if (scrollState != OnScrollListener.SCROLL_STATE_IDLE) {
    mHandler.clearImageFecthing();
  }
 else   if (mDisplayPhotos) {
    processMissingImageItems(view);
  }
}

Fixed version (ground truth):
public void onScrollStateChanged(AbsListView view,int scrollState){
  mScrollState=scrollState;
  if (scrollState != OnScrollListener.SCROLL_STATE_IDLE) {
    clearImageFetching();
  }
 else   if (mDisplayPhotos) {
    processMissingImageItems(view);
  }
}
Program: 184133
Project: 184133
Buggy source:
private void queryContactInfo(CallerInfoQuery ciq){
  ContactInfo info=mContactInfo.get(ciq.number);
  if (info != null && info != ContactInfo.EMPTY) {
synchronized (mRequests) {
      if (mRequests.isEmpty()) {
        mHandler.sendEmptyMessage(REDRAW);
      }
    }
  }
 else {
    Cursor phonesCursor=RecentCallsListActivity.this.getContentResolver().query(Uri.withAppendedPath(Phones.CONTENT_FILTER_URL,Uri.encode(ciq.number)),PHONES_PROJECTION,null,null,null);
    if (phonesCursor != null) {
      if (phonesCursor.moveToFirst()) {
        info=new ContactInfo();
        info.personId=phonesCursor.getLong(PERSON_ID_COLUMN_INDEX);
        info.name=phonesCursor.getString(NAME_COLUMN_INDEX);
        info.type=phonesCursor.getInt(PHONE_TYPE_COLUMN_INDEX);
        info.label=phonesCursor.getString(LABEL_COLUMN_INDEX);
        info.number=phonesCursor.getString(MATCHED_NUMBER_COLUMN_INDEX);
        info.formattedNumber=null;
        mContactInfo.put(ciq.number,info);
synchronized (mRequests) {
          if (mRequests.isEmpty()) {
            mHandler.sendEmptyMessage(REDRAW);
          }
        }
      }
      phonesCursor.close();
    }
  }
  if (info != null && info != ContactInfo.EMPTY) {
    updateCallLog(ciq,info);
  }
}

Fixed version (ground truth):
private void queryContactInfo(CallerInfoQuery ciq){
  ContactInfo info=mContactInfo.get(ciq.number);
  if (info != null && info != ContactInfo.EMPTY) {
synchronized (mRequests) {
      if (mRequests.isEmpty()) {
        mHandler.sendEmptyMessage(REDRAW);
      }
    }
  }
 else {
    Cursor phonesCursor=RecentCallsListActivity.this.getContentResolver().query(Uri.withAppendedPath(Phones.CONTENT_FILTER_URL,Uri.encode(ciq.number)),PHONES_PROJECTION,null,null,null);
    if (phonesCursor != null) {
      if (phonesCursor.moveToFirst()) {
        info=new ContactInfo();
        info.personId=phonesCursor.getLong(PERSON_ID_COLUMN_INDEX);
        info.name=phonesCursor.getString(NAME_COLUMN_INDEX);
        info.type=phonesCursor.getInt(PHONE_TYPE_COLUMN_INDEX);
        info.label=phonesCursor.getString(LABEL_COLUMN_INDEX);
        info.number=phonesCursor.getString(MATCHED_NUMBER_COLUMN_INDEX);
        info.formattedNumber=null;
        mContactInfo.put(ciq.number,info);
synchronized (mRequests) {
          if (mRequests.isEmpty()) {
            mHandler.sendEmptyMessage(REDRAW);
          }
        }
      }
      phonesCursor.close();
    }
  }
  if (info != null) {
    updateCallLog(ciq,info);
  }
}
Program: 184134
Project: 184134
Buggy source:
private void queryContactInfo(CallerInfoQuery ciq){
  ContactInfo info=mContactInfo.get(ciq.number);
  if (info != null && info != ContactInfo.EMPTY) {
synchronized (mRequests) {
      if (mRequests.isEmpty()) {
        mHandler.sendEmptyMessage(REDRAW);
      }
    }
  }
 else {
    Cursor phonesCursor=RecentCallsListActivity.this.getContentResolver().query(Uri.withAppendedPath(Phones.CONTENT_FILTER_URL,Uri.encode(ciq.number)),PHONES_PROJECTION,null,null,null);
    if (phonesCursor != null) {
      if (phonesCursor.moveToFirst()) {
        info=new ContactInfo();
        info.personId=phonesCursor.getLong(PERSON_ID_COLUMN_INDEX);
        info.name=phonesCursor.getString(NAME_COLUMN_INDEX);
        info.type=phonesCursor.getInt(PHONE_TYPE_COLUMN_INDEX);
        info.label=phonesCursor.getString(LABEL_COLUMN_INDEX);
        info.number=phonesCursor.getString(MATCHED_NUMBER_COLUMN_INDEX);
        info.formattedNumber=null;
        mContactInfo.put(ciq.number,info);
synchronized (mRequests) {
          if (mRequests.isEmpty()) {
            mHandler.sendEmptyMessage(REDRAW);
          }
        }
      }
      phonesCursor.close();
    }
  }
  if (info != null && info != ContactInfo.EMPTY) {
    updateCallLog(ciq,info);
  }
}

Fixed version (ground truth):
private void queryContactInfo(CallerInfoQuery ciq){
  ContactInfo info=mContactInfo.get(ciq.number);
  if (info != null && info != ContactInfo.EMPTY) {
synchronized (mRequests) {
      if (mRequests.isEmpty()) {
        mHandler.sendEmptyMessage(REDRAW);
      }
    }
  }
 else {
    Cursor phonesCursor=RecentCallsListActivity.this.getContentResolver().query(Uri.withAppendedPath(Phones.CONTENT_FILTER_URL,Uri.encode(ciq.number)),PHONES_PROJECTION,null,null,null);
    if (phonesCursor != null) {
      if (phonesCursor.moveToFirst()) {
        info=new ContactInfo();
        info.personId=phonesCursor.getLong(PERSON_ID_COLUMN_INDEX);
        info.name=phonesCursor.getString(NAME_COLUMN_INDEX);
        info.type=phonesCursor.getInt(PHONE_TYPE_COLUMN_INDEX);
        info.label=phonesCursor.getString(LABEL_COLUMN_INDEX);
        info.number=phonesCursor.getString(MATCHED_NUMBER_COLUMN_INDEX);
        info.formattedNumber=null;
        mContactInfo.put(ciq.number,info);
synchronized (mRequests) {
          if (mRequests.isEmpty()) {
            mHandler.sendEmptyMessage(REDRAW);
          }
        }
      }
      phonesCursor.close();
    }
  }
  if (info != null) {
    updateCallLog(ciq,info);
  }
}
Program: 184135
Project: 184135
Buggy source:
/** 
 * Overridden by subclasses to control the resource used by the content view. 
 */
protected int getContentViewResource(){
  return R.layout.twelve_key_dialer;
}

Fixed version (ground truth):
/** 
 * Overridden by subclasses to control the resource used by the content view.
 */
protected int getContentViewResource(){
  return R.layout.twelve_key_dialer;
}
Program: 184137
Project: 184137
Buggy source:
@Override protected void onResume(){
  super.onResume();
  mDTMFToneEnabled=Settings.System.getInt(getContentResolver(),Settings.System.DTMF_TONE_WHEN_DIALING,1) == 1;
synchronized (mToneGeneratorLock) {
    if (mToneGenerator == null) {
      try {
        mToneGenerator=new ToneGenerator(AudioManager.STREAM_VOICE_CALL,TONE_RELATIVE_VOLUME);
      }
 catch (      RuntimeException e) {
        Log.w(TAG,"String_Node_Str" + e);
        mToneGenerator=null;
      }
    }
  }
  Activity parent=getParent();
  if (parent != null && parent instanceof DialtactsActivity) {
    Uri dialUri=((DialtactsActivity)parent).getAndClearDialUri();
    if (dialUri != null) {
      resolveIntent();
    }
  }
  TelephonyManager telephonyManager=(TelephonyManager)getSystemService(TELEPHONY_SERVICE);
  telephonyManager.listen(mPhoneStateListener,PhoneStateListener.LISTEN_CALL_STATE);
  if (phoneIsInUse()) {
    mDigits.setHint(R.string.dialerDialpadHintText);
  }
 else {
    mDigits.setHint(null);
    showDialpadChooser(false);
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  mDTMFToneEnabled=Settings.System.getInt(getContentResolver(),Settings.System.DTMF_TONE_WHEN_DIALING,1) == 1;
synchronized (mToneGeneratorLock) {
    if (mToneGenerator == null) {
      try {
        mToneGenerator=new ToneGenerator(AudioManager.STREAM_DTMF,TONE_RELATIVE_VOLUME);
      }
 catch (      RuntimeException e) {
        Log.w(TAG,"String_Node_Str" + e);
        mToneGenerator=null;
      }
    }
  }
  Activity parent=getParent();
  if (parent != null && parent instanceof DialtactsActivity) {
    Uri dialUri=((DialtactsActivity)parent).getAndClearDialUri();
    if (dialUri != null) {
      resolveIntent();
    }
  }
  TelephonyManager telephonyManager=(TelephonyManager)getSystemService(TELEPHONY_SERVICE);
  telephonyManager.listen(mPhoneStateListener,PhoneStateListener.LISTEN_CALL_STATE);
  if (phoneIsInUse()) {
    mDigits.setHint(R.string.dialerDialpadHintText);
  }
 else {
    mDigits.setHint(null);
    showDialpadChooser(false);
  }
}
Program: 184139
Project: 184139
Buggy source:
@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.view_contact);
  getListView().setOnCreateContextMenuListener(this);
  mNameView=(TextView)findViewById(R.id.name);
  mPhoneticNameView=(TextView)findViewById(R.id.phonetic_name);
  mPhotoView=(ImageView)findViewById(R.id.photo);
  mStarView=(CheckBox)findViewById(R.id.star);
  mStarView.setOnClickListener(this);
  long now=SystemClock.elapsedRealtime();
  int num=(int)now & 0xf;
  if (num < 9) {
    mNoPhotoResource=R.drawable.ic_contact_picture;
  }
 else   if (num < 14) {
    mNoPhotoResource=R.drawable.ic_contact_picture_2;
  }
 else {
    mNoPhotoResource=R.drawable.ic_contact_picture_3;
  }
  mUri=getIntent().getData();
  mResolver=getContentResolver();
  mSections.add(mPhoneEntries);
  mSections.add(mSmsEntries);
  mSections.add(mEmailEntries);
  mSections.add(mImEntries);
  mSections.add(mPostalEntries);
  mSections.add(mOrganizationEntries);
  mSections.add(mGroupEntries);
  mSections.add(mOtherEntries);
  mShowSmsLinksForAllPhones=true;
  mCursor=mResolver.query(mUri,AGGREGATE_PROJECTION,null,null,null);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.view_contact);
  getListView().setOnCreateContextMenuListener(this);
  mNameView=(TextView)findViewById(R.id.name);
  mPhoneticNameView=(TextView)findViewById(R.id.phonetic_name);
  mPhotoView=(ImageView)findViewById(R.id.photo);
  mStarView=(CheckBox)findViewById(R.id.star);
  mStarView.setOnClickListener(this);
  long now=SystemClock.elapsedRealtime();
  int num=(int)now & 0xf;
  if (num < 9) {
    mNoPhotoResource=R.drawable.ic_contact_picture;
  }
 else   if (num < 14) {
    mNoPhotoResource=R.drawable.ic_contact_picture_2;
  }
 else {
    mNoPhotoResource=R.drawable.ic_contact_picture_3;
  }
  mUri=Uri.withAppendedPath(getIntent().getData(),"String_Node_Str");
  mResolver=getContentResolver();
  mSections.add(mPhoneEntries);
  mSections.add(mSmsEntries);
  mSections.add(mEmailEntries);
  mSections.add(mImEntries);
  mSections.add(mPostalEntries);
  mSections.add(mOrganizationEntries);
  mSections.add(mGroupEntries);
  mSections.add(mOtherEntries);
  mShowSmsLinksForAllPhones=true;
  mCursor=mResolver.query(mUri,AGGREGATE_PROJECTION,null,null,null);
}
Program: 184140
Project: 184140
Buggy source:
@Override protected void onRestart(){
  super.onRestart();
  if (TextUtils.isEmpty(getListView().getTextFilter())) {
    startQuery();
  }
 else {
    ((ContactItemListAdapter)getListView().getAdapter()).onContentChanged();
  }
}

Fixed version (ground truth):
@Override protected void onRestart(){
  super.onRestart();
  if (TextUtils.isEmpty(getListView().getTextFilter())) {
    startQuery();
  }
 else {
    ((ContactItemListAdapter)getListAdapter()).onContentChanged();
  }
}
Program: 184142
Project: 184142
Buggy source:
private void calculateData(){
  long set=0;
  long group=0;
  if (groupSize.getText().toString().equals("String_Node_Str")) {
    set=Long.parseLong(setSize.getText().toString());
    group=Long.parseLong(setSize.getText().toString());
  }
 else {
    set=Long.parseLong(setSize.getText().toString());
    group=Long.parseLong(groupSize.getText().toString());
  }
  if (group > set) {
    Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    return;
  }
  permVal.setText(String.valueOf(PermComb.calcPermutations(set,group)));
  permWithRep.setText(String.valueOf(PermComb.calcPermutationsWithRep(set,group)));
  combVal.setText(String.valueOf(PermComb.calcCombinations(set,group)));
  combWithRep.setText(String.valueOf(PermComb.calcCombinationsWithRep(set,group)));
  numSubset.setText(String.valueOf(PermComb.calcNumSubset(set)));
  pigeonhole.setText(String.valueOf(PermComb.calcPigeonhole(set,group)));
}

Fixed version (ground truth):
private void calculateData(){
  long set=0;
  long group=0;
  if (setSize.getText().toString().equals("String_Node_Str")) {
    Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    return;
  }
  if (groupSize.getText().toString().equals("String_Node_Str")) {
    set=Long.parseLong(setSize.getText().toString());
    group=Long.parseLong(setSize.getText().toString());
  }
 else {
    set=Long.parseLong(setSize.getText().toString());
    group=Long.parseLong(groupSize.getText().toString());
  }
  if (group > set) {
    Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    return;
  }
  permVal.setText(String.valueOf(PermComb.calcPermutations(set,group)));
  permWithRep.setText(String.valueOf(PermComb.calcPermutationsWithRep(set,group)));
  combVal.setText(String.valueOf(PermComb.calcCombinations(set,group)));
  combWithRep.setText(String.valueOf(PermComb.calcCombinationsWithRep(set,group)));
  numSubset.setText(String.valueOf(PermComb.calcNumSubset(set)));
  pigeonhole.setText(String.valueOf(PermComb.calcPigeonhole(set,group)));
}
Program: 184143
Project: 184143
Buggy source:
public double getR(){
  return Math.sqrt(this.getRSquared());
}

Fixed version (ground truth):
public double getR(){
  double meanX=x.getMean();
  double meanY=y.getMean();
  double sum=0;
  int sampleSize=y.getSampleSize();
  for (int i=0; i < sampleSize; i++) {
    sum+=(x.getValue(i) - meanX) * (y.getValue(i) - meanY);
  }
  return sum / ((sampleSize) * y.getStandardDeviation() * x.getStandardDeviation());
}
Program: 184145
Project: 184145
Buggy source:
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  if (resultCode != RESULT_OK)   return;
  if (data.hasExtra("String_Node_Str"))   dataValues=data.getStringExtra("String_Node_Str");
  analyzeData();
}

Fixed version (ground truth):
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  ((FrameLayout)findViewById(R.id.regression_graph)).addView(chart);
  if (resultCode != RESULT_OK)   return;
  if (data.hasExtra("String_Node_Str"))   dataValues=data.getStringExtra("String_Node_Str");
  analyzeData();
}
Program: 184146
Project: 184146
Buggy source:
public double getMean(){
  double mean=0;
  for (int i=0; i < sample.size(); i++) {
    mean+=sample.get(i);
  }
  return mean;
}

Fixed version (ground truth):
public double getMean(){
  double mean=0;
  mean=this.getSum();
  mean/=sample.size();
  return mean;
}
Program: 184147
Project: 184147
Buggy source:
private void sortArray(){
  for (int i=0; i < sample.size() - 1; i++) {
    for (int j=1; j < sample.size(); j++) {
      if (sample.get(j) < sample.get(i)) {
        Double temp=sample.get(j);
        sample.set(j,sample.get(i));
        sample.set(i,temp);
        temp=null;
      }
    }
  }
}

Fixed version (ground truth):
private void sortArray(){
  for (int i=0; i < sample.size() - 1; i++) {
    for (int j=i + 1; j < sample.size(); j++) {
      if (sample.get(j) < sample.get(i)) {
        Double temp=sample.get(j);
        sample.set(j,sample.get(i));
        sample.set(i,temp);
        temp=null;
      }
    }
  }
}
Program: 184150
Project: 184150
Buggy source:
/** 
 * Reads data from the file, adding pixels as we go
 * @param r
 * @return 0 if pixels were read and added, 1 if the end of the file wasreached (whether or not pixels were actually added is unreported), -1 if there was an error (such as an IO exception)
 */
public int addPixels(Regions r){
  String nextLine=null;
  while (true) {
    try {
      mInputFile.mark(200);
      nextLine=mInputFile.readLine();
      if (nextLine == null) {
        mInputFile.close();
        return 1;
      }
    }
 catch (    IOException e) {
      e.printStackTrace();
      return -1;
    }
    String[] values=nextLine.split("String_Node_Str");
    long timeStamp=Long.parseLong(values[0]) * 1000;
    if (passesTimeFilters(timeStamp) == false) {
      continue;
    }
    if (isInCurrentTimeSlice(timeStamp) == false) {
      try {
        mInputFile.reset();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
      updateCurrentTimeSlice();
      return 0;
    }
    double x=Double.parseDouble(values[2]) - xBase;
    double y=Double.parseDouble(values[3].trim()) - yBase;
    int xScaled=(int)(x / xScaleFactor);
    int yScaled=(int)(y / yScaleFactor);
    r.addDataReading(new Point(xScaled,yScaled));
  }
}

Fixed version (ground truth):
/** 
 * Reads data from the file, adding pixels as we go
 * @param r
 * @return 0 if pixels were read and added, 1 if the end of the file wasreached (whether or not pixels were actually added is unreported) or we have reached the end of the available data (bascally, normal termination), -1 if there was an error (such as an IO exception)
 */
public int addPixels(Regions r){
  String nextLine=null;
  while (true) {
    try {
      mInputFile.mark(200);
      nextLine=mInputFile.readLine();
      if (nextLine == null) {
        mInputFile.close();
        return 1;
      }
    }
 catch (    IOException e) {
      e.printStackTrace();
      return -1;
    }
    String[] values=nextLine.split("String_Node_Str");
    long timeStamp=Long.parseLong(values[0]) * 1000;
    if (isInCurrentTimeSlice(timeStamp) == false) {
      try {
        mInputFile.reset();
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
      updateCurrentTimeSlice();
      return 0;
    }
    if (passesDayMonthYearTimeFilters(timeStamp) == false) {
      mTempCalendar.setTimeInMillis(timeStamp);
      if (mTempCalendar.after(mRangeEnd))       return 1;
 else       continue;
    }
    if (passesHourFilter(timeStamp) == false)     continue;
    double x=Double.parseDouble(values[2]) - xBase;
    double y=Double.parseDouble(values[3].trim()) - yBase;
    int xScaled=(int)(x / xScaleFactor);
    int yScaled=(int)(y / yScaleFactor);
    r.addDataReading(new Point(xScaled,yScaled));
  }
}