nus-yam/ex-repair huggingface dataset:
Program: 7420
Project: 7420
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: 7421
Project: 7421
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: 7422
Project: 7422
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: 7424
Project: 7424
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: 7425
Project: 7425
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: 7426
Project: 7426
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: 7427
Project: 7427
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: 7428
Project: 7428
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: 7429
Project: 7429
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: 7430
Project: 7430
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: 7431
Project: 7431
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: 7432
Project: 7432
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: 7433
Project: 7433
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: 7434
Project: 7434
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: 7435
Project: 7435
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: 7436
Project: 7436
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: 7437
Project: 7437
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: 7438
Project: 7438
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: 7439
Project: 7439
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: 7440
Project: 7440
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: 7441
Project: 7441
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: 7442
Project: 7442
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: 7443
Project: 7443
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: 7444
Project: 7444
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: 7445
Project: 7445
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: 7446
Project: 7446
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: 7447
Project: 7447
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: 7448
Project: 7448
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: 7450
Project: 7450
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: 7451
Project: 7451
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: 7453
Project: 7453
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: 7454
Project: 7454
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: 7456
Project: 7456
Buggy source:
/** 
 * Compiles the script code. This will be done automatically the first time the procedure is run, but may be practical to do at other times as well in order to detect errors.
 * @throws ProcedureException if the script couldn't be compiledcorrectly
 */
public void compile() throws ProcedureException {
  JsErrorHandler errorHandler=new JsErrorHandler();
  Context cx;
  String[] lines;
  String str;
  StringBuffer code=new StringBuffer();
  int idx;
  cx=Context.enter();
  try {
    cx.setLanguageVersion(Context.VERSION_ES6);
    cx.setErrorReporter(errorHandler);
    str=(String)getBindings().getValue(BINDING_CODE);
    lines=str.split("String_Node_Str");
    idx=lines.length - 1;
    while (idx >= 0 && lines[idx].trim().length() <= 0) {
      idx--;
    }
    if (idx >= 0) {
      str=lines[idx];
      if (!str.contains("String_Node_Str")) {
        lines[idx]="String_Node_Str" + str;
      }
    }
    code.append("String_Node_Str");
    for (int i=0; i < lines.length; i++) {
      code.append(lines[i]);
      code.append("String_Node_Str");
    }
    code.append("String_Node_Str");
    script=cx.compileString(code.toString(),getName(),0,null);
    if (errorHandler.getErrorCount() > 0) {
      throw new ProcedureException(errorHandler.getErrorText());
    }
  }
 catch (  Exception e) {
    script=null;
    if (errorHandler.getErrorCount() > 0) {
      throw new ProcedureException(errorHandler.getErrorText());
    }
    throw createException(e);
  }
 finally {
    Context.exit();
  }
}

Fixed version (ground truth):
/** 
 * Compiles the script code. This will be done automatically the first time the procedure is run, but may be practical to do at other times as well in order to detect errors.
 * @throws ProcedureException if the script couldn't be compiledcorrectly
 */
public void compile() throws ProcedureException {
  JsErrorHandler errorHandler=new JsErrorHandler();
  Context cx;
  String[] lines;
  String str;
  StringBuffer code=new StringBuffer();
  int idx;
  cx=Context.enter();
  try {
    cx.setLanguageVersion(Context.VERSION_ES6);
    cx.setErrorReporter(errorHandler);
    str=(String)getBindings().getValue(BINDING_CODE);
    lines=str.split("String_Node_Str");
    idx=lines.length - 1;
    while (idx >= 0 && lines[idx].trim().length() <= 0) {
      idx--;
    }
    if (idx >= 0) {
      str=lines[idx];
      if (!str.contains("String_Node_Str") && !str.contains("String_Node_Str")) {
        lines[idx]="String_Node_Str" + str;
      }
    }
    code.append("String_Node_Str");
    for (int i=0; i < lines.length; i++) {
      code.append(lines[i]);
      code.append("String_Node_Str");
    }
    code.append("String_Node_Str");
    script=cx.compileString(code.toString(),getName(),0,null);
    if (errorHandler.getErrorCount() > 0) {
      throw new ProcedureException(errorHandler.getErrorText());
    }
  }
 catch (  Exception e) {
    script=null;
    if (errorHandler.getErrorCount() > 0) {
      throw new ProcedureException(errorHandler.getErrorText());
    }
    throw createException(e);
  }
 finally {
    Context.exit();
  }
}