nus-yam/ex-repair huggingface dataset:
Program: 183995
Project: 183995
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_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);
  }
  updateDialAndDeleteButtonStateEnabledAttr();
}

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(DIAL_TONE_STREAM_TYPE,TONE_RELATIVE_VOLUME);
        setVolumeControlStream(DIAL_TONE_STREAM_TYPE);
      }
 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);
  }
  updateDialAndDeleteButtonStateEnabledAttr();
}
Program: 183996
Project: 183996
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_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);
  }
  updateDialAndDeleteButtonStateEnabledAttr();
}

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(DIAL_TONE_STREAM_TYPE,TONE_RELATIVE_VOLUME);
        setVolumeControlStream(DIAL_TONE_STREAM_TYPE);
      }
 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);
  }
  updateDialAndDeleteButtonStateEnabledAttr();
}
Program: 183997
Project: 183997
Buggy source:
@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(getContentViewResource());
  Resources r=getResources();
  mDigitsBackground=r.getDrawable(R.drawable.btn_dial_textfield_active);
  mDigitsEmptyBackground=r.getDrawable(R.drawable.btn_dial_textfield);
  mDeleteBackground=r.getDrawable(R.drawable.btn_dial_delete_active);
  mDeleteEmptyBackground=r.getDrawable(R.drawable.btn_dial_delete);
  mDigits=(EditText)findViewById(R.id.digits);
  mDigits.setKeyListener(DialerKeyListener.getInstance());
  mDigits.setOnClickListener(this);
  mDigits.setOnKeyListener(this);
  maybeAddNumberFormatting();
  View view=findViewById(R.id.one);
  if (view != null) {
    setupKeypad();
  }
  view=findViewById(R.id.backspace);
  view.setOnClickListener(this);
  view.setOnLongClickListener(this);
  mDelete=view;
  mDigitsAndBackspace=(View)findViewById(R.id.digitsAndBackspace);
  mDialpad=(View)findViewById(R.id.dialpad);
  mDialpadChooser=(ListView)findViewById(R.id.dialpadChooser);
  mDialpadChooser.setOnItemClickListener(this);
  if (!resolveIntent() && icicle != null) {
    super.onRestoreInstanceState(icicle);
  }
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;
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(getContentViewResource());
  Resources r=getResources();
  mDigitsBackground=r.getDrawable(R.drawable.btn_dial_textfield_active);
  mDigitsEmptyBackground=r.getDrawable(R.drawable.btn_dial_textfield);
  mDeleteBackground=r.getDrawable(R.drawable.btn_dial_delete_active);
  mDeleteEmptyBackground=r.getDrawable(R.drawable.btn_dial_delete);
  mDigits=(EditText)findViewById(R.id.digits);
  mDigits.setKeyListener(DialerKeyListener.getInstance());
  mDigits.setOnClickListener(this);
  mDigits.setOnKeyListener(this);
  maybeAddNumberFormatting();
  View view=findViewById(R.id.one);
  if (view != null) {
    setupKeypad();
  }
  view=findViewById(R.id.backspace);
  view.setOnClickListener(this);
  view.setOnLongClickListener(this);
  mDelete=view;
  mDigitsAndBackspace=(View)findViewById(R.id.digitsAndBackspace);
  mDialpad=(View)findViewById(R.id.dialpad);
  mDialpadChooser=(ListView)findViewById(R.id.dialpadChooser);
  mDialpadChooser.setOnItemClickListener(this);
  if (!resolveIntent() && icicle != null) {
    super.onRestoreInstanceState(icicle);
  }
synchronized (mToneGeneratorLock) {
    if (mToneGenerator == null) {
      try {
        mToneGenerator=new ToneGenerator(AudioManager.STREAM_RING,TONE_RELATIVE_VOLUME);
      }
 catch (      RuntimeException e) {
        Log.w(TAG,"String_Node_Str" + e);
        mToneGenerator=null;
      }
    }
  }
}
Program: 183998
Project: 183998
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_RING,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: 183999
Project: 183999
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_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);
  }
  updateDialAndDeleteButtonStateEnabledAttr();
}

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(DIAL_TONE_STREAM_TYPE,TONE_RELATIVE_VOLUME);
        setVolumeControlStream(DIAL_TONE_STREAM_TYPE);
      }
 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);
  }
  updateDialAndDeleteButtonStateEnabledAttr();
}
Program: 184000
Project: 184000
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  if (!mDataValid) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (position == 0 && (mMode & MODE_MASK_SHOW_NUMBER_OF_CONTACTS) != 0) {
    return getTotalContactCountView(parent);
  }
  if (isShowAllContactsItemPosition(position)) {
    LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    return inflater.inflate(R.layout.contacts_list_show_all_item,parent,false);
  }
  int separatorId=getSeparatorId(position);
  if (separatorId != 0) {
    LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    TextView view=(TextView)inflater.inflate(R.layout.list_separator,parent,false);
    view.setText(separatorId);
    return view;
  }
  boolean showingSuggestion;
  Cursor cursor;
  if (mSuggestionsCursorCount != 0 && position < mSuggestionsCursorCount + 2) {
    showingSuggestion=true;
    cursor=mSuggestionsCursor;
  }
 else {
    showingSuggestion=false;
    cursor=mCursor;
  }
  int realPosition=getRealPosition(position);
  if (!cursor.moveToPosition(realPosition)) {
    throw new IllegalStateException("String_Node_Str" + position);
  }
  View v;
  if (convertView == null) {
    v=newView(mContext,cursor,parent);
  }
 else {
    v=convertView;
  }
  bindView(v,mContext,cursor);
  bindSectionHeader(v,realPosition,mDisplaySectionHeaders && !showingSuggestion);
  return v;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  if (!mDataValid) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (position == 0 && (mMode & MODE_MASK_SHOW_NUMBER_OF_CONTACTS) != 0) {
    return getTotalContactCountView(parent);
  }
  if (isShowAllContactsItemPosition(position)) {
    LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    return inflater.inflate(R.layout.contacts_list_show_all_item,parent,false);
  }
  int separatorId=getSeparatorId(position);
  if (separatorId != 0) {
    LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    TextView view=(TextView)inflater.inflate(R.layout.list_separator,parent,false);
    view.setText(separatorId);
    return view;
  }
  boolean showingSuggestion;
  Cursor cursor;
  if (mSuggestionsCursorCount != 0 && position < mSuggestionsCursorCount + 2) {
    showingSuggestion=true;
    cursor=mSuggestionsCursor;
  }
 else {
    showingSuggestion=false;
    cursor=mCursor;
  }
  int realPosition=getRealPosition(position);
  if (!cursor.moveToPosition(realPosition)) {
    throw new IllegalStateException("String_Node_Str" + position);
  }
  View v;
  if (convertView == null || convertView.getTag() == null) {
    v=newView(mContext,cursor,parent);
  }
 else {
    v=convertView;
  }
  bindView(v,mContext,cursor);
  bindSectionHeader(v,realPosition,mDisplaySectionHeaders && !showingSuggestion);
  return v;
}
Program: 184001
Project: 184001
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  if (!mDataValid) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (position == 0 && (mMode & MODE_MASK_SHOW_NUMBER_OF_CONTACTS) != 0) {
    return getTotalContactCountView(parent);
  }
  if (isShowAllContactsItemPosition(position)) {
    LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    return inflater.inflate(R.layout.contacts_list_show_all_item,parent,false);
  }
  int separatorId=getSeparatorId(position);
  if (separatorId != 0) {
    LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    TextView view=(TextView)inflater.inflate(R.layout.list_separator,parent,false);
    view.setText(separatorId);
    return view;
  }
  boolean showingSuggestion;
  Cursor cursor;
  if (mSuggestionsCursorCount != 0 && position < mSuggestionsCursorCount + 2) {
    showingSuggestion=true;
    cursor=mSuggestionsCursor;
  }
 else {
    showingSuggestion=false;
    cursor=mCursor;
  }
  int realPosition=getRealPosition(position);
  if (!cursor.moveToPosition(realPosition)) {
    throw new IllegalStateException("String_Node_Str" + position);
  }
  View v;
  if (convertView == null) {
    v=newView(mContext,cursor,parent);
  }
 else {
    v=convertView;
  }
  bindView(v,mContext,cursor);
  bindSectionHeader(v,realPosition,mDisplaySectionHeaders && !showingSuggestion);
  return v;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  if (!mDataValid) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (position == 0 && (mMode & MODE_MASK_SHOW_NUMBER_OF_CONTACTS) != 0) {
    return getTotalContactCountView(parent);
  }
  if (isShowAllContactsItemPosition(position)) {
    LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    return inflater.inflate(R.layout.contacts_list_show_all_item,parent,false);
  }
  int separatorId=getSeparatorId(position);
  if (separatorId != 0) {
    LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    TextView view=(TextView)inflater.inflate(R.layout.list_separator,parent,false);
    view.setText(separatorId);
    return view;
  }
  boolean showingSuggestion;
  Cursor cursor;
  if (mSuggestionsCursorCount != 0 && position < mSuggestionsCursorCount + 2) {
    showingSuggestion=true;
    cursor=mSuggestionsCursor;
  }
 else {
    showingSuggestion=false;
    cursor=mCursor;
  }
  int realPosition=getRealPosition(position);
  if (!cursor.moveToPosition(realPosition)) {
    throw new IllegalStateException("String_Node_Str" + position);
  }
  View v;
  if (convertView == null || convertView.getTag() == null) {
    v=newView(mContext,cursor,parent);
  }
 else {
    v=convertView;
  }
  bindView(v,mContext,cursor);
  bindSectionHeader(v,realPosition,mDisplaySectionHeaders && !showingSuggestion);
  return v;
}
Program: 184002
Project: 184002
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  if (!mDataValid) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (position == 0 && (mMode & MODE_MASK_SHOW_NUMBER_OF_CONTACTS) != 0) {
    return getTotalContactCountView(parent);
  }
  if (isShowAllContactsItemPosition(position)) {
    LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    return inflater.inflate(R.layout.contacts_list_show_all_item,parent,false);
  }
  int separatorId=getSeparatorId(position);
  if (separatorId != 0) {
    LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    TextView view=(TextView)inflater.inflate(R.layout.list_separator,parent,false);
    view.setText(separatorId);
    return view;
  }
  boolean showingSuggestion;
  Cursor cursor;
  if (mSuggestionsCursorCount != 0 && position < mSuggestionsCursorCount + 2) {
    showingSuggestion=true;
    cursor=mSuggestionsCursor;
  }
 else {
    showingSuggestion=false;
    cursor=mCursor;
  }
  int realPosition=getRealPosition(position);
  if (!cursor.moveToPosition(realPosition)) {
    throw new IllegalStateException("String_Node_Str" + position);
  }
  View v;
  if (convertView == null) {
    v=newView(mContext,cursor,parent);
  }
 else {
    v=convertView;
  }
  bindView(v,mContext,cursor);
  bindSectionHeader(v,realPosition,mDisplaySectionHeaders && !showingSuggestion);
  return v;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  if (!mDataValid) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (position == 0 && (mMode & MODE_MASK_SHOW_NUMBER_OF_CONTACTS) != 0) {
    return getTotalContactCountView(parent);
  }
  if (isShowAllContactsItemPosition(position)) {
    LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    return inflater.inflate(R.layout.contacts_list_show_all_item,parent,false);
  }
  int separatorId=getSeparatorId(position);
  if (separatorId != 0) {
    LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    TextView view=(TextView)inflater.inflate(R.layout.list_separator,parent,false);
    view.setText(separatorId);
    return view;
  }
  boolean showingSuggestion;
  Cursor cursor;
  if (mSuggestionsCursorCount != 0 && position < mSuggestionsCursorCount + 2) {
    showingSuggestion=true;
    cursor=mSuggestionsCursor;
  }
 else {
    showingSuggestion=false;
    cursor=mCursor;
  }
  int realPosition=getRealPosition(position);
  if (!cursor.moveToPosition(realPosition)) {
    throw new IllegalStateException("String_Node_Str" + position);
  }
  View v;
  if (convertView == null || convertView.getTag() == null) {
    v=newView(mContext,cursor,parent);
  }
 else {
    v=convertView;
  }
  bindView(v,mContext,cursor);
  bindSectionHeader(v,realPosition,mDisplaySectionHeaders && !showingSuggestion);
  return v;
}
Program: 184003
Project: 184003
Buggy source:
String[] getProjectionForQuery(){
switch (mMode) {
case MODE_JOIN_CONTACT:
case MODE_STREQUENT:
case MODE_FREQUENT:
case MODE_STARRED:
case MODE_QUERY:
case MODE_DEFAULT:
case MODE_INSERT_OR_EDIT_CONTACT:
case MODE_GROUP:
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
{
      return CONTACTS_SUMMARY_PROJECTION;
    }
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
    return LEGACY_PEOPLE_PROJECTION;
  }
case MODE_PICK_PHONE:
{
  return PHONES_PROJECTION;
}
case MODE_LEGACY_PICK_PHONE:
{
return LEGACY_PHONES_PROJECTION;
}
case MODE_PICK_POSTAL:
{
return POSTALS_PROJECTION;
}
case MODE_LEGACY_PICK_POSTAL:
{
return LEGACY_POSTALS_PROJECTION;
}
case MODE_QUERY_PICK_TO_VIEW:
{
if (mQueryMode == QUERY_MODE_MAILTO) {
return CONTACTS_SUMMARY_PROJECTION;
}
 else if (mQueryMode == QUERY_MODE_TEL) {
return PHONES_PROJECTION;
}
break;
}
}
return CONTACTS_SUMMARY_PROJECTION;
}

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

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

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

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

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

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

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

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

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

Fixed version (ground truth):
@Override protected void onSaveInstanceState(Bundle outState){
  if (hasValidState()) {
    outState.putParcelable(KEY_EDIT_STATE,mState);
  }
  outState.putLong(KEY_RAW_CONTACT_ID_REQUESTING_PHOTO,mRawContactIdRequestingPhoto);
  super.onSaveInstanceState(outState);
}
Program: 184016
Project: 184016
Buggy source:
String[] getProjectionForQuery(){
switch (mMode) {
case MODE_JOIN_CONTACT:
case MODE_STREQUENT:
case MODE_FREQUENT:
case MODE_STARRED:
case MODE_QUERY:
case MODE_DEFAULT:
case MODE_INSERT_OR_EDIT_CONTACT:
case MODE_GROUP:
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
{
      return CONTACTS_SUMMARY_PROJECTION;
    }
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
    return LEGACY_PEOPLE_PROJECTION;
  }
case MODE_PICK_PHONE:
{
  return PHONES_PROJECTION;
}
case MODE_LEGACY_PICK_PHONE:
{
return LEGACY_PHONES_PROJECTION;
}
case MODE_PICK_POSTAL:
{
return POSTALS_PROJECTION;
}
case MODE_LEGACY_PICK_POSTAL:
{
return LEGACY_POSTALS_PROJECTION;
}
case MODE_QUERY_PICK_TO_VIEW:
{
if (mQueryMode == QUERY_MODE_MAILTO) {
return CONTACTS_SUMMARY_PROJECTION;
}
 else if (mQueryMode == QUERY_MODE_TEL) {
return PHONES_PROJECTION;
}
break;
}
}
return CONTACTS_SUMMARY_PROJECTION;
}

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

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

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

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

Fixed version (ground truth):
Uri getUriToQuery(){
switch (mMode) {
case MODE_JOIN_CONTACT:
    return getJoinSuggestionsUri(null);
case MODE_FREQUENT:
case MODE_STARRED:
case MODE_DEFAULT:
case MODE_INSERT_OR_EDIT_CONTACT:
case MODE_PICK_CONTACT:
case MODE_PICK_OR_CREATE_CONTACT:
{
    return Contacts.CONTENT_URI;
  }
case MODE_STREQUENT:
{
  return Contacts.CONTENT_STREQUENT_URI;
}
case MODE_LEGACY_PICK_PERSON:
case MODE_LEGACY_PICK_OR_CREATE_PERSON:
{
return People.CONTENT_URI;
}
case MODE_PICK_PHONE:
{
return Phone.CONTENT_URI;
}
case MODE_LEGACY_PICK_PHONE:
{
return Phones.CONTENT_URI;
}
case MODE_PICK_POSTAL:
{
return StructuredPostal.CONTENT_URI;
}
case MODE_LEGACY_PICK_POSTAL:
{
return ContactMethods.CONTENT_URI;
}
case MODE_QUERY_PICK_TO_VIEW:
{
if (mQueryMode == QUERY_MODE_MAILTO) {
return Uri.withAppendedPath(Email.CONTENT_FILTER_URI,Uri.encode(mQueryData));
}
 else if (mQueryMode == QUERY_MODE_TEL) {
return Uri.withAppendedPath(Phone.CONTENT_FILTER_URI,Uri.encode(mQueryData));
}
}
case MODE_QUERY:
{
return getContactFilterUri(mQueryData);
}
case MODE_GROUP:
{
return mGroupUri;
}
default :
{
throw new IllegalStateException("String_Node_Str");
}
}
}