nus-yam/ex-repair huggingface dataset:
Program: 184691
Project: 184691
Buggy source:
private Runnable callback(final int position,final int offset,final boolean isThumb,final Bitmap bitmap){
  return new Runnable(){
    public void run(){
      if (!isCanceled() && position == mCurrentPosition) {
        mCB.imageLoaded(position,offset,bitmap,isThumb);
      }
 else {
        if (bitmap != null)         bitmap.recycle();
      }
    }
  }
;
}

Fixed version (ground truth):
private Runnable callback(final int position,final int offset,final boolean isThumb,final Bitmap bitmap){
  return new Runnable(){
    public void run(){
      if (!isCanceled() && position == mCurrentPosition) {
        mCB.imageLoaded(position,offset,bitmap,isThumb);
      }
 else       if (bitmap != null) {
        bitmap.recycle();
      }
    }
  }
;
}
Program: 184692
Project: 184692
Buggy source:
public void run(){
  mLayoutComplete=true;
  setImage(mCurrentPosition);
}

Fixed version (ground truth):
public void run(){
  if (mMode == MODE_NORMAL)   return;
  ImageViewTouchBase oldView=mSlideShowImageViews[mSlideShowImageCurrent];
  if (++mSlideShowImageCurrent == mSlideShowImageViews.length) {
    mSlideShowImageCurrent=0;
  }
  ImageViewTouchBase newView=mSlideShowImageViews[mSlideShowImageCurrent];
  newView.setVisibility(View.VISIBLE);
  newView.setImageBitmapResetBase(bitmap,isThumb,isThumb);
  newView.bringToFront();
  int animation=0;
  if (mAnimationIndex == -1) {
    int n=mRandom.nextInt(mSlideShowInAnimation.length);
    animation=n;
  }
 else {
    animation=mAnimationIndex;
  }
  Animation aIn=mSlideShowInAnimation[animation];
  newView.setAnimation(aIn);
  newView.setVisibility(View.VISIBLE);
  aIn.startNow();
  Animation aOut=mSlideShowOutAnimation[animation];
  oldView.setVisibility(View.INVISIBLE);
  oldView.setAnimation(aOut);
  aOut.startNow();
  mCurrentPosition=requestedPos;
  if (mCurrentPosition == mLastSlideShowImage && !firstCall) {
    if (mSlideShowLoop) {
      if (mUseShuffleOrder) {
        generateShuffleOrder();
      }
    }
 else {
      setMode(MODE_NORMAL);
      return;
    }
  }
  if (Config.LOGV)   Log.v(TAG,"String_Node_Str" + mCurrentPosition);
  loadNextImage((mCurrentPosition + 1) % mAllImages.getCount(),mSlideShowInterval,false);
}
Program: 184693
Project: 184693
Buggy source:
public ScrollHandler(Context context,AttributeSet attrs){
  super(context,attrs);
  mScrollerHelper=new Scroller(context);
}

Fixed version (ground truth):
public ScrollHandler(Context context,AttributeSet attrs){
  super(context,attrs);
  mScrollerHelper=new Scroller(context);
  mViewImage=(ViewImage)context;
}
Program: 184694
Project: 184694
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  int width=right - left;
  int x=0;
  for (  View v : new View[]{findViewById(R.id.image1),findViewById(R.id.image2),findViewById(R.id.image3)}) {
    v.layout(x,0,x + width,bottom);
    x+=(width + sPadding);
  }
  findViewById(R.id.padding1).layout(width,0,width + sPadding,bottom);
  findViewById(R.id.padding2).layout(width + sPadding + width,0,width + sPadding + width+ sPadding,bottom);
  if (changed) {
    if (mFirstLayoutCompletedCallback != null) {
      mFirstLayoutCompletedCallback.run();
    }
  }
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  int width=right - left;
  int x=0;
  for (  View v : new View[]{findViewById(R.id.image1),findViewById(R.id.image2),findViewById(R.id.image3)}) {
    v.layout(x,0,x + width,bottom);
    x+=(width + sPadding);
  }
  findViewById(R.id.padding1).layout(width,0,width + sPadding,bottom);
  findViewById(R.id.padding2).layout(width + sPadding + width,0,width + sPadding + width+ sPadding,bottom);
  if (changed) {
    mViewImage.mLayoutComplete=true;
    mViewImage.onLayoutChanged();
  }
}
Program: 184695
Project: 184695
Buggy source:
@Override public void onResume(){
  super.onResume();
  init(mSavedUri);
  int count=mAllImages.getCount();
  if (count == 0) {
    finish();
  }
 else   if (count <= mCurrentPosition) {
    mCurrentPosition=count - 1;
  }
  ImageManager.IImage image=mAllImages.getImageAt(mCurrentPosition);
  if (mGetter == null) {
    makeGetter();
  }
  mFirst=true;
  mScroller.setLayoutCompletedCallback(new Runnable(){
    public void run(){
      mLayoutComplete=true;
      setImage(mCurrentPosition);
    }
  }
);
  setImage(mCurrentPosition);
  setOrientation();
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  init(mSavedUri);
  int count=mAllImages.getCount();
  if (count == 0) {
    finish();
  }
 else   if (count <= mCurrentPosition) {
    mCurrentPosition=count - 1;
  }
  ImageManager.IImage image=mAllImages.getImageAt(mCurrentPosition);
  if (mGetter == null) {
    makeGetter();
  }
  mFirst=true;
  setImage(mCurrentPosition);
}
Program: 184699
Project: 184699
Buggy source:
private Runnable callback(final int position,final int offset,final boolean isThumb,final Bitmap bitmap){
  return new Runnable(){
    public void run(){
      if (!isCanceled() && position == mCurrentPosition) {
        mCB.imageLoaded(position,offset,bitmap,isThumb);
      }
 else {
        if (bitmap != null)         bitmap.recycle();
      }
    }
  }
;
}

Fixed version (ground truth):
private Runnable callback(final int position,final int offset,final boolean isThumb,final Bitmap bitmap){
  return new Runnable(){
    public void run(){
      if (!isCanceled() && position == mCurrentPosition) {
        mCB.imageLoaded(position,offset,bitmap,isThumb);
      }
 else       if (bitmap != null) {
        bitmap.recycle();
      }
    }
  }
;
}
Program: 184700
Project: 184700
Buggy source:
NotificationMgr(Context context){
  mContext=context;
  mSettings=CallFeaturesSetting.getInstance(PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()));
  mNotificationMgr=(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
  mStatusBar=(StatusBarManager)context.getSystemService(Context.STATUS_BAR_SERVICE);
  PhoneApp app=PhoneApp.getInstance();
  mPhone=app.phone;
}

Fixed version (ground truth):
NotificationMgr(Context context){
  mContext=context;
  mSettings=CallFeaturesSetting.getInstance(PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()));
  mNotificationMgr=(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
  mStatusBar=(StatusBarManager)context.getSystemService(Context.STATUS_BAR_SERVICE);
  PhoneApp app=PhoneApp.getInstance();
  mPhone=app.phone;
  IntentFilter filter=new IntentFilter();
  filter.addAction(CLEAR_MISSED_CALLS);
  context.registerReceiver(mClearReceiver,filter);
}
Program: 184701
Project: 184701
Buggy source:
/** 
 * Displays a notification about a missed call.
 * @param nameOrNumber either the contact name, or the phone number if no contact
 * @param label the label of the number if nameOrNumber is a name, null if it is a number
 */
void notifyMissedCall(String name,String number,String label,long date){
  int titleResId;
  String expandedText, callName;
  mNumberMissedCalls++;
  if (name != null && TextUtils.isGraphic(name)) {
    callName=name;
  }
 else   if (!TextUtils.isEmpty(number)) {
    callName=number;
  }
 else {
    callName=mContext.getString(R.string.unknown);
  }
  if (mNumberMissedCalls == 1) {
    titleResId=R.string.notification_missedCallTitle;
    expandedText=callName;
  }
 else {
    titleResId=R.string.notification_missedCallsTitle;
    expandedText=mContext.getString(R.string.notification_missedCallsMsg,mNumberMissedCalls);
  }
  final Intent intent=PhoneApp.createCallLogIntent();
  Notification note=new Notification(mContext,android.R.drawable.stat_notify_missed_call,mContext.getString(R.string.notification_missedCallTicker,callName),date,mContext.getText(titleResId),expandedText,intent);
  if (mSettings.mLedNotify)   configureLedNotification(note);
  mNotificationMgr.notify(MISSED_CALL_NOTIFICATION,note);
}

Fixed version (ground truth):
/** 
 * Displays a notification about a missed call.
 * @param nameOrNumber either the contact name, or the phone number if no contact
 * @param label the label of the number if nameOrNumber is a name, null if it is a number
 */
void notifyMissedCall(String name,String number,String label,long date){
  int titleResId;
  String expandedText, callName;
  mNumberMissedCalls++;
  if (name != null && TextUtils.isGraphic(name)) {
    callName=name;
  }
 else   if (!TextUtils.isEmpty(number)) {
    callName=number;
  }
 else {
    callName=mContext.getString(R.string.unknown);
  }
  if (mNumberMissedCalls == 1) {
    titleResId=R.string.notification_missedCallTitle;
    expandedText=callName;
  }
 else {
    titleResId=R.string.notification_missedCallsTitle;
    expandedText=mContext.getString(R.string.notification_missedCallsMsg,mNumberMissedCalls);
  }
  final Intent intent=PhoneApp.createCallLogIntent();
  Notification note=new Notification(mContext,android.R.drawable.stat_notify_missed_call,mContext.getString(R.string.notification_missedCallTicker,callName),date,mContext.getText(titleResId),expandedText,intent);
  if (mSettings.mLedNotify)   configureLedNotification(note);
  note.deleteIntent=PendingIntent.getBroadcast(mContext,-1,new Intent(CLEAR_MISSED_CALLS),0);
  mNotificationMgr.notify(MISSED_CALL_NOTIFICATION,note);
}
Program: 184706
Project: 184706
Buggy source:
@Override public void handleMessage(Message msg){
  AsyncResult result=(AsyncResult)msg.obj;
switch (msg.what) {
case EVENT_VOICEMAIL_CHANGED:
    mVoicemailChangeResult=result;
  if (DBG)   log("String_Node_Str");
break;
case EVENT_FORWARDING_CHANGED:
mForwardingChangeResults.put(msg.arg1,result);
if (result.exception != null) {
if (DBG) log("String_Node_Str" + msg.arg1 + "String_Node_Str"+ result.exception.getMessage());
}
 else {
if (DBG) log("String_Node_Str" + msg.arg1);
}
if (DBG) log("String_Node_Str");
break;
default :
}
final boolean done=(!mVMChangeCompletedSuccesfully || mVoicemailChangeResult != null) && (!mFwdChangesRequireRollback || checkForwardingCompleted());
if (done) {
if (DBG) log("String_Node_Str");
dismissDialog(VOICEMAIL_REVERTING_DIALOG);
onRevertDone();
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  AsyncResult result=(AsyncResult)msg.obj;
switch (msg.what) {
case EVENT_VOICEMAIL_CHANGED:
    mVoicemailChangeResult=result;
  if (DBG)   log("String_Node_Str");
break;
case EVENT_FORWARDING_CHANGED:
mForwardingChangeResults.put(msg.arg1,result);
if (result.exception != null) {
if (DBG) log("String_Node_Str" + msg.arg1 + "String_Node_Str"+ result.exception.getMessage());
}
 else {
if (DBG) log("String_Node_Str" + msg.arg1);
}
if (DBG) log("String_Node_Str");
break;
default :
}
final boolean done=(!mVMChangeCompletedSuccesfully || mVoicemailChangeResult != null) && (!mFwdChangesRequireRollback || checkForwardingCompleted());
if (done) {
if (DBG) log("String_Node_Str");
dismissDialogSafely(VOICEMAIL_REVERTING_DIALOG);
onRevertDone();
}
}
Program: 184709
Project: 184709
Buggy source:
@Override public void handleMessage(Message msg){
  AsyncResult result=(AsyncResult)msg.obj;
switch (msg.what) {
case EVENT_VOICEMAIL_CHANGED:
    mVoicemailChangeResult=result;
  if (DBG)   log("String_Node_Str");
break;
case EVENT_FORWARDING_CHANGED:
mForwardingChangeResults.put(msg.arg1,result);
if (result.exception != null) {
if (DBG) log("String_Node_Str" + msg.arg1 + "String_Node_Str"+ result.exception.getMessage());
}
 else {
if (DBG) log("String_Node_Str" + msg.arg1);
}
if (DBG) log("String_Node_Str");
break;
default :
}
final boolean done=(!mVMChangeCompletedSuccesfully || mVoicemailChangeResult != null) && (!mFwdChangesRequireRollback || checkForwardingCompleted());
if (done) {
if (DBG) log("String_Node_Str");
dismissDialog(VOICEMAIL_REVERTING_DIALOG);
onRevertDone();
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  AsyncResult result=(AsyncResult)msg.obj;
switch (msg.what) {
case EVENT_VOICEMAIL_CHANGED:
    mVoicemailChangeResult=result;
  if (DBG)   log("String_Node_Str");
break;
case EVENT_FORWARDING_CHANGED:
mForwardingChangeResults.put(msg.arg1,result);
if (result.exception != null) {
if (DBG) log("String_Node_Str" + msg.arg1 + "String_Node_Str"+ result.exception.getMessage());
}
 else {
if (DBG) log("String_Node_Str" + msg.arg1);
}
if (DBG) log("String_Node_Str");
break;
default :
}
final boolean done=(!mVMChangeCompletedSuccesfully || mVoicemailChangeResult != null) && (!mFwdChangesRequireRollback || checkForwardingCompleted());
if (done) {
if (DBG) log("String_Node_Str");
dismissDialogSafely(VOICEMAIL_REVERTING_DIALOG);
onRevertDone();
}
}
Program: 184710
Project: 184710
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  KeyEvent event=(KeyEvent)intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
  if (VDBG)   Log.d(LOG_TAG,"String_Node_Str" + event);
  if ((event != null) && (event.getKeyCode() == KeyEvent.KEYCODE_HEADSETHOOK) && (event.getAction() == KeyEvent.ACTION_DOWN)) {
    if (event.getRepeatCount() == 0) {
      if (VDBG)       Log.d(LOG_TAG,"String_Node_Str");
      boolean consumed=PhoneUtils.handleHeadsetHook(phone);
      if (VDBG)       Log.d(LOG_TAG,"String_Node_Str" + consumed);
      if (consumed) {
        if (isShowingCallScreen()) {
          updateInCallScreenTouchUi();
        }
        abortBroadcast();
      }
    }
 else     if (phone.getState() != Phone.State.IDLE) {
      abortBroadcast();
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  KeyEvent event=(KeyEvent)intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
  if (VDBG)   Log.d(LOG_TAG,"String_Node_Str" + event);
  if ((event != null) && (event.getKeyCode() == KeyEvent.KEYCODE_HEADSETHOOK)) {
    if (VDBG)     Log.d(LOG_TAG,"String_Node_Str");
    boolean consumed=PhoneUtils.handleHeadsetHook(phone,event);
    if (VDBG)     Log.d(LOG_TAG,"String_Node_Str" + consumed);
    if (consumed) {
      if (isShowingCallScreen()) {
        updateInCallScreenTouchUi();
      }
      abortBroadcast();
    }
  }
 else {
    if (phone.getState() != Phone.State.IDLE) {
      if (VDBG)       Log.d(LOG_TAG,"String_Node_Str");
      abortBroadcast();
    }
  }
}
Program: 184713
Project: 184713
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case EVENT_TTY_MODE_GET:
    handleQueryTTYModeResponse(msg);
  break;
case EVENT_TTY_MODE_SET:
handleSetTTYModeResponse(msg);
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  AsyncResult result=(AsyncResult)msg.obj;
switch (msg.what) {
case EVENT_VOICEMAIL_CHANGED:
    mVoicemailChangeResult=result;
  if (DBG)   log("String_Node_Str");
break;
case EVENT_FORWARDING_CHANGED:
mForwardingChangeResults.put(msg.arg1,result);
if (result.exception != null) {
if (DBG) log("String_Node_Str" + msg.arg1 + "String_Node_Str"+ result.exception.getMessage());
}
 else {
if (DBG) log("String_Node_Str" + msg.arg1);
}
if (DBG) log("String_Node_Str");
break;
default :
}
final boolean done=(!mVMChangeCompletedSuccesfully || mVoicemailChangeResult != null) && (!mFwdChangesRequireRollback || checkForwardingCompleted());
if (done) {
if (DBG) log("String_Node_Str");
dismissDialog(VOICEMAIL_REVERTING_DIALOG);
onRevertDone();
}
}
Program: 184714
Project: 184714
Buggy source:
@Override protected void onResume(){
  super.onResume();
  if (mButtonDTMF != null) {
    int dtmf=Settings.System.getInt(getContentResolver(),Settings.System.DTMF_TONE_TYPE_WHEN_DIALING,DTMF_TONE_TYPE_NORMAL);
    mButtonDTMF.setValueIndex(dtmf);
  }
  if (mButtonAutoRetry != null) {
    int autoretry=Settings.System.getInt(getContentResolver(),Settings.System.CALL_AUTO_RETRY,0);
    mButtonAutoRetry.setChecked(autoretry != 0);
  }
  if (mButtonHAC != null) {
    int hac=Settings.System.getInt(getContentResolver(),Settings.System.HEARING_AID,0);
    mButtonHAC.setChecked(hac != 0);
  }
  if (mButtonTTY != null) {
    mPhone.queryTTYMode(ttyHandler.obtainMessage(TTYHandler.EVENT_TTY_MODE_GET));
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (mButtonDTMF != null) {
    int dtmf=Settings.System.getInt(getContentResolver(),Settings.System.DTMF_TONE_TYPE_WHEN_DIALING,DTMF_TONE_TYPE_NORMAL);
    mButtonDTMF.setValueIndex(dtmf);
  }
  if (mButtonAutoRetry != null) {
    int autoretry=Settings.System.getInt(getContentResolver(),Settings.System.CALL_AUTO_RETRY,0);
    mButtonAutoRetry.setChecked(autoretry != 0);
  }
  if (mButtonHAC != null) {
    int hac=Settings.System.getInt(getContentResolver(),Settings.System.HEARING_AID,0);
    mButtonHAC.setChecked(hac != 0);
  }
  if (mButtonTTY != null) {
    int settingsTtyMode=Settings.Secure.getInt(getContentResolver(),Settings.Secure.PREFERRED_TTY_MODE,Phone.TTY_MODE_OFF);
    mButtonTTY.setValue(Integer.toString(settingsTtyMode));
    updatePreferredTtyModeSummary(settingsTtyMode);
  }
}
Program: 184715
Project: 184715
Buggy source:
private void handleTTYChange(Preference preference,Object objValue){
  int buttonTtyMode;
  buttonTtyMode=Integer.valueOf((String)objValue).intValue();
  int settingsTtyMode=android.provider.Settings.Secure.getInt(getContentResolver(),android.provider.Settings.Secure.PREFERRED_TTY_MODE,preferredTtyMode);
  if (DBG)   log("String_Node_Str" + Integer.toString(buttonTtyMode));
  if (buttonTtyMode != settingsTtyMode) {
switch (buttonTtyMode) {
case Phone.TTY_MODE_OFF:
case Phone.TTY_MODE_FULL:
case Phone.TTY_MODE_HCO:
case Phone.TTY_MODE_VCO:
      mPhone.setTTYMode(buttonTtyMode,ttyHandler.obtainMessage(TTYHandler.EVENT_TTY_MODE_SET));
    break;
default :
  mPhone.setTTYMode(Phone.TTY_MODE_OFF,ttyHandler.obtainMessage(TTYHandler.EVENT_TTY_MODE_SET));
}
}
}

Fixed version (ground truth):
private void handleTTYChange(Preference preference,Object objValue){
  int buttonTtyMode;
  buttonTtyMode=Integer.valueOf((String)objValue).intValue();
  int settingsTtyMode=android.provider.Settings.Secure.getInt(getContentResolver(),android.provider.Settings.Secure.PREFERRED_TTY_MODE,preferredTtyMode);
  if (DBG)   log("String_Node_Str" + Integer.toString(buttonTtyMode));
  if (buttonTtyMode != settingsTtyMode) {
switch (buttonTtyMode) {
case Phone.TTY_MODE_OFF:
case Phone.TTY_MODE_FULL:
case Phone.TTY_MODE_HCO:
case Phone.TTY_MODE_VCO:
      android.provider.Settings.Secure.putInt(getContentResolver(),android.provider.Settings.Secure.PREFERRED_TTY_MODE,buttonTtyMode);
    break;
default :
  buttonTtyMode=Phone.TTY_MODE_OFF;
}
mButtonTTY.setValue(Integer.toString(buttonTtyMode));
updatePreferredTtyModeSummary(buttonTtyMode);
Intent ttyModeChanged=new Intent(TtyIntent.TTY_PREFERRED_MODE_CHANGE_ACTION);
ttyModeChanged.putExtra(TtyIntent.TTY_PREFFERED_MODE,buttonTtyMode);
sendBroadcast(ttyModeChanged);
}
}
Program: 184717
Project: 184717
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  KeyEvent event=(KeyEvent)intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
  if (VDBG)   Log.d(LOG_TAG,"String_Node_Str" + event);
  if ((event != null) && (event.getKeyCode() == KeyEvent.KEYCODE_HEADSETHOOK) && (event.getAction() == KeyEvent.ACTION_DOWN)) {
    if (event.getRepeatCount() == 0) {
      if (VDBG)       Log.d(LOG_TAG,"String_Node_Str");
      boolean consumed=PhoneUtils.handleHeadsetHook(phone);
      if (VDBG)       Log.d(LOG_TAG,"String_Node_Str" + consumed);
      if (consumed) {
        if (isShowingCallScreen()) {
          updateInCallScreenTouchUi();
        }
        abortBroadcast();
      }
    }
 else     if (phone.getState() != Phone.State.IDLE) {
      abortBroadcast();
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  KeyEvent event=(KeyEvent)intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
  if (VDBG)   Log.d(LOG_TAG,"String_Node_Str" + event);
  if ((event != null) && (event.getKeyCode() == KeyEvent.KEYCODE_HEADSETHOOK)) {
    if (VDBG)     Log.d(LOG_TAG,"String_Node_Str");
    boolean consumed=PhoneUtils.handleHeadsetHook(phone,event);
    if (VDBG)     Log.d(LOG_TAG,"String_Node_Str" + consumed);
    if (consumed) {
      if (isShowingCallScreen()) {
        updateInCallScreenTouchUi();
      }
      abortBroadcast();
    }
  }
 else {
    if (phone.getState() != Phone.State.IDLE) {
      if (VDBG)       Log.d(LOG_TAG,"String_Node_Str");
      abortBroadcast();
    }
  }
}
Program: 184720
Project: 184720
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case EVENT_TTY_MODE_GET:
    handleQueryTTYModeResponse(msg);
  break;
case EVENT_TTY_MODE_SET:
handleSetTTYModeResponse(msg);
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  AsyncResult result=(AsyncResult)msg.obj;
switch (msg.what) {
case EVENT_VOICEMAIL_CHANGED:
    mVoicemailChangeResult=result;
  if (DBG)   log("String_Node_Str");
break;
case EVENT_FORWARDING_CHANGED:
mForwardingChangeResults.put(msg.arg1,result);
if (result.exception != null) {
if (DBG) log("String_Node_Str" + msg.arg1 + "String_Node_Str"+ result.exception.getMessage());
}
 else {
if (DBG) log("String_Node_Str" + msg.arg1);
}
if (DBG) log("String_Node_Str");
break;
default :
}
final boolean done=(!mVMChangeCompletedSuccesfully || mVoicemailChangeResult != null) && (!mFwdChangesRequireRollback || checkForwardingCompleted());
if (done) {
if (DBG) log("String_Node_Str");
dismissDialog(VOICEMAIL_REVERTING_DIALOG);
onRevertDone();
}
}
Program: 184721
Project: 184721
Buggy source:
@Override protected void onResume(){
  super.onResume();
  if (mButtonDTMF != null) {
    int dtmf=Settings.System.getInt(getContentResolver(),Settings.System.DTMF_TONE_TYPE_WHEN_DIALING,DTMF_TONE_TYPE_NORMAL);
    mButtonDTMF.setValueIndex(dtmf);
  }
  if (mButtonAutoRetry != null) {
    int autoretry=Settings.System.getInt(getContentResolver(),Settings.System.CALL_AUTO_RETRY,0);
    mButtonAutoRetry.setChecked(autoretry != 0);
  }
  if (mButtonHAC != null) {
    int hac=Settings.System.getInt(getContentResolver(),Settings.System.HEARING_AID,0);
    mButtonHAC.setChecked(hac != 0);
  }
  if (mButtonTTY != null) {
    mPhone.queryTTYMode(ttyHandler.obtainMessage(TTYHandler.EVENT_TTY_MODE_GET));
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (mButtonDTMF != null) {
    int dtmf=Settings.System.getInt(getContentResolver(),Settings.System.DTMF_TONE_TYPE_WHEN_DIALING,DTMF_TONE_TYPE_NORMAL);
    mButtonDTMF.setValueIndex(dtmf);
  }
  if (mButtonAutoRetry != null) {
    int autoretry=Settings.System.getInt(getContentResolver(),Settings.System.CALL_AUTO_RETRY,0);
    mButtonAutoRetry.setChecked(autoretry != 0);
  }
  if (mButtonHAC != null) {
    int hac=Settings.System.getInt(getContentResolver(),Settings.System.HEARING_AID,0);
    mButtonHAC.setChecked(hac != 0);
  }
  if (mButtonTTY != null) {
    int settingsTtyMode=Settings.Secure.getInt(getContentResolver(),Settings.Secure.PREFERRED_TTY_MODE,Phone.TTY_MODE_OFF);
    mButtonTTY.setValue(Integer.toString(settingsTtyMode));
    updatePreferredTtyModeSummary(settingsTtyMode);
  }
}
Program: 184722
Project: 184722
Buggy source:
private void handleTTYChange(Preference preference,Object objValue){
  int buttonTtyMode;
  buttonTtyMode=Integer.valueOf((String)objValue).intValue();
  int settingsTtyMode=android.provider.Settings.Secure.getInt(getContentResolver(),android.provider.Settings.Secure.PREFERRED_TTY_MODE,preferredTtyMode);
  if (DBG)   log("String_Node_Str" + Integer.toString(buttonTtyMode));
  if (buttonTtyMode != settingsTtyMode) {
switch (buttonTtyMode) {
case Phone.TTY_MODE_OFF:
case Phone.TTY_MODE_FULL:
case Phone.TTY_MODE_HCO:
case Phone.TTY_MODE_VCO:
      mPhone.setTTYMode(buttonTtyMode,ttyHandler.obtainMessage(TTYHandler.EVENT_TTY_MODE_SET));
    break;
default :
  mPhone.setTTYMode(Phone.TTY_MODE_OFF,ttyHandler.obtainMessage(TTYHandler.EVENT_TTY_MODE_SET));
}
}
}

Fixed version (ground truth):
private void handleTTYChange(Preference preference,Object objValue){
  int buttonTtyMode;
  buttonTtyMode=Integer.valueOf((String)objValue).intValue();
  int settingsTtyMode=android.provider.Settings.Secure.getInt(getContentResolver(),android.provider.Settings.Secure.PREFERRED_TTY_MODE,preferredTtyMode);
  if (DBG)   log("String_Node_Str" + Integer.toString(buttonTtyMode));
  if (buttonTtyMode != settingsTtyMode) {
switch (buttonTtyMode) {
case Phone.TTY_MODE_OFF:
case Phone.TTY_MODE_FULL:
case Phone.TTY_MODE_HCO:
case Phone.TTY_MODE_VCO:
      android.provider.Settings.Secure.putInt(getContentResolver(),android.provider.Settings.Secure.PREFERRED_TTY_MODE,buttonTtyMode);
    break;
default :
  buttonTtyMode=Phone.TTY_MODE_OFF;
}
mButtonTTY.setValue(Integer.toString(buttonTtyMode));
updatePreferredTtyModeSummary(buttonTtyMode);
Intent ttyModeChanged=new Intent(TtyIntent.TTY_PREFERRED_MODE_CHANGE_ACTION);
ttyModeChanged.putExtra(TtyIntent.TTY_PREFFERED_MODE,buttonTtyMode);
sendBroadcast(ttyModeChanged);
}
}
Program: 184728
Project: 184728
Buggy source:
/** 
 * Implemented for CallerInfoAsyncQuery.OnQueryCompleteListener interface. refreshes the CallCard data when it called.
 */
public void onQueryComplete(int token,Object cookie,CallerInfo ci){
  if (DBG)   log("String_Node_Str" + token + "String_Node_Str"+ cookie+ "String_Node_Str"+ ci);
  if (cookie instanceof Call) {
    if (DBG)     log("String_Node_Str");
    Call call=(Call)cookie;
    Connection conn=call.getEarliestConnection();
    PhoneUtils.CallerInfoToken cit=PhoneUtils.startGetCallerInfo(getContext(),conn,this,null);
    int presentation=Connection.PRESENTATION_ALLOWED;
    if (conn != null)     presentation=conn.getNumberPresentation();
    if (DBG)     log("String_Node_Str" + presentation + "String_Node_Str"+ ci.contactExists);
    if (ci.contactExists) {
      updateDisplayForPerson(ci,Connection.PRESENTATION_ALLOWED,false,call);
    }
 else {
      updateDisplayForPerson(cit.currentInfo,presentation,false,call);
    }
    updatePhotoForCallState(call);
  }
 else   if (cookie instanceof TextView) {
    if (DBG)     log("String_Node_Str");
    ((TextView)cookie).setText(PhoneUtils.getCompactNameFromCallerInfo(ci,mContext));
  }
}

Fixed version (ground truth):
/** 
 * Implemented for CallerInfoAsyncQuery.OnQueryCompleteListener interface. refreshes the CallCard data when it called.
 */
public void onQueryComplete(int token,Object cookie,CallerInfo ci){
  if (DBG)   log("String_Node_Str" + token + "String_Node_Str"+ cookie+ "String_Node_Str"+ ci);
  if (cookie instanceof Call) {
    if (DBG)     log("String_Node_Str");
    Call call=(Call)cookie;
    Connection conn=null;
    int phoneType=mApplication.phone.getPhoneType();
    if (phoneType == Phone.PHONE_TYPE_CDMA) {
      conn=call.getLatestConnection();
    }
 else     if (phoneType == Phone.PHONE_TYPE_GSM) {
      conn=call.getEarliestConnection();
    }
 else {
      throw new IllegalStateException("String_Node_Str" + phoneType);
    }
    PhoneUtils.CallerInfoToken cit=PhoneUtils.startGetCallerInfo(getContext(),conn,this,null);
    int presentation=Connection.PRESENTATION_ALLOWED;
    if (conn != null)     presentation=conn.getNumberPresentation();
    if (DBG)     log("String_Node_Str" + presentation + "String_Node_Str"+ ci.contactExists);
    if (ci.contactExists) {
      updateDisplayForPerson(ci,Connection.PRESENTATION_ALLOWED,false,call);
    }
 else {
      updateDisplayForPerson(cit.currentInfo,presentation,false,call);
    }
    updatePhotoForCallState(call);
  }
 else   if (cookie instanceof TextView) {
    if (DBG)     log("String_Node_Str");
    ((TextView)cookie).setText(PhoneUtils.getCompactNameFromCallerInfo(ci,mContext));
  }
}
Program: 184729
Project: 184729
Buggy source:
private void onRingbackTone(AsyncResult r){
  boolean playTone=(Boolean)(r.result);
  if (playTone == true) {
    if (mInCallRingbackTonePlayer == null) {
      mInCallRingbackTonePlayer=new InCallRingbackTonePlayer();
    }
    if (mInCallRingbackTonePlayer != null && mPhone.getForegroundCall().getState().isDialing() && mCurrentRingbackToneState == RINGBACK_TONE_OFF) {
      mInCallRingbackTonePlayer.start();
    }
  }
 else {
    if (mInCallRingbackTonePlayer != null && mCurrentRingbackToneState == RINGBACK_TONE_ON) {
      mInCallRingbackTonePlayer.stop();
    }
  }
}

Fixed version (ground truth):
private void onRingbackTone(AsyncResult r){
  boolean playTone=(Boolean)(r.result);
  if (playTone == true) {
    if (mPhone.getForegroundCall().getState().isDialing() && mInCallRingbackTonePlayer == null) {
      mInCallRingbackTonePlayer=new InCallTonePlayer(InCallTonePlayer.TONE_RING_BACK);
      mInCallRingbackTonePlayer.start();
    }
  }
 else {
    if (mInCallRingbackTonePlayer != null) {
      mInCallRingbackTonePlayer.stopTone();
      mInCallRingbackTonePlayer=null;
    }
  }
}
Program: 184731
Project: 184731
Buggy source:
/** 
 * constructor
 */
public EmergencyTonePlayerVibrator(){
  Context context=mApplication.getApplicationContext();
  mAudioManager=(AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
}

Fixed version (ground truth):
/** 
 * constructor
 */
public EmergencyTonePlayerVibrator(){
}
Program: 184735
Project: 184735
Buggy source:
/** 
 * start the ringback tone
 */
private void start(){
  if (VDBG)   log("String_Node_Str");
  AudioManager audioManager=(AudioManager)mPhone.getContext().getSystemService(Context.AUDIO_SERVICE);
  try {
    int stream;
    if (mBluetoothHandsfree != null) {
      stream=mBluetoothHandsfree.isAudioOn() ? AudioManager.STREAM_BLUETOOTH_SCO : AudioManager.STREAM_VOICE_CALL;
    }
 else {
      stream=AudioManager.STREAM_VOICE_CALL;
    }
    mToneGenerator=new ToneGenerator(stream,InCallTonePlayer.TONE_RELATIVE_VOLUME_HIPRI);
  }
 catch (  RuntimeException e) {
    Log.w(LOG_TAG,"String_Node_Str" + e);
    mToneGenerator=null;
  }
  if (mToneGenerator != null) {
    mToneGenerator.startTone(ToneGenerator.TONE_SUP_RINGTONE);
    mCurrentRingbackToneState=RINGBACK_TONE_ON;
  }
}

Fixed version (ground truth):
/** 
 * Start the emergency tone or vibrator.
 */
private void start(){
  if (VDBG)   log("String_Node_Str");
  int ringerMode=mAudioManager.getRingerMode();
  if ((mIsEmergencyToneOn == EMERGENCY_TONE_ALERT) && (ringerMode == AudioManager.RINGER_MODE_NORMAL)) {
    if (VDBG)     log("String_Node_Str");
    mToneGenerator=new ToneGenerator(AudioManager.STREAM_VOICE_CALL,InCallTonePlayer.TONE_RELATIVE_VOLUME_HIPRI);
    if (mToneGenerator != null) {
      mToneGenerator.startTone(ToneGenerator.TONE_CDMA_EMERGENCY_RINGBACK);
      mCurrentEmergencyToneState=EMERGENCY_TONE_ALERT;
    }
  }
 else   if (mIsEmergencyToneOn == EMERGENCY_TONE_VIBRATE) {
    if (VDBG)     log("String_Node_Str");
    mEmgVibrator=new Vibrator();
    if (mEmgVibrator != null) {
      mEmgVibrator.vibrate(mVibratePattern,0);
      mCurrentEmergencyToneState=EMERGENCY_TONE_VIBRATE;
    }
  }
}
Program: 184736
Project: 184736
Buggy source:
InCallTonePlayer(int toneId){
  super();
  mToneId=toneId;
}

Fixed version (ground truth):
InCallTonePlayer(int toneId){
  super();
  mToneId=toneId;
  mState=TONE_OFF;
}
Program: 184738
Project: 184738
Buggy source:
/** 
 * If the ringback tone is playing, stop it and release toneGenerator.
 */
private void stop(){
  if (VDBG)   log("String_Node_Str");
  if (mToneGenerator != null) {
    mToneGenerator.stopTone();
    mToneGenerator.release();
    mToneGenerator=null;
  }
  mCurrentRingbackToneState=RINGBACK_TONE_OFF;
}

Fixed version (ground truth):
/** 
 * If the emergency tone is active, stop the tone or vibrator accordingly.
 */
private void stop(){
  if (VDBG)   log("String_Node_Str");
  if ((mCurrentEmergencyToneState == EMERGENCY_TONE_ALERT) && (mToneGenerator != null)) {
    mToneGenerator.stopTone();
    mToneGenerator.release();
  }
 else   if ((mCurrentEmergencyToneState == EMERGENCY_TONE_VIBRATE) && (mEmgVibrator != null)) {
    mEmgVibrator.cancel();
  }
  mCurrentEmergencyToneState=EMERGENCY_TONE_OFF;
}
Program: 184740
Project: 184740
Buggy source:
/** 
 * Convert a Connection object into a single +CLCC result for CDMA phones 
 */
private String cdmaConnectionToClccEntry(int index,Connection c){
  int state;
  PhoneApp app=PhoneApp.getInstance();
  CdmaPhoneCallState.PhoneCallState currCdmaCallState=app.cdmaPhoneCallState.getCurrentCallState();
  CdmaPhoneCallState.PhoneCallState prevCdmaCallState=app.cdmaPhoneCallState.getPreviousCallState();
  if ((prevCdmaCallState == CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE) && (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.CONF_CALL)) {
    state=0;
  }
 else {
switch (c.getState()) {
case ACTIVE:
      if (index == 0) {
        state=mCdmaIsSecondCallActive ? 1 : 0;
      }
 else {
        state=mCdmaIsSecondCallActive ? 0 : 1;
      }
    break;
case HOLDING:
  state=1;
break;
case DIALING:
state=2;
break;
case ALERTING:
state=3;
break;
case INCOMING:
state=4;
break;
case WAITING:
state=5;
break;
default :
return null;
}
}
int mpty=0;
if (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.SINGLE_ACTIVE) {
mpty=0;
}
 else {
mpty=1;
}
int direction=c.isIncoming() ? 1 : 0;
String number=c.getAddress();
int type=-1;
if (number != null) {
type=PhoneNumberUtils.toaFromString(number);
}
String result="String_Node_Str" + (index + 1) + "String_Node_Str"+ direction+ "String_Node_Str"+ state+ "String_Node_Str"+ mpty;
if (number != null) {
result+="String_Node_Str" + number + "String_Node_Str"+ type;
}
return result;
}

Fixed version (ground truth):
/** 
 * Convert a Connection object into a single +CLCC result for CDMA phones 
 */
private String cdmaConnectionToClccEntry(int index,Connection c){
  int state;
  PhoneApp app=PhoneApp.getInstance();
  CdmaPhoneCallState.PhoneCallState currCdmaCallState=app.cdmaPhoneCallState.getCurrentCallState();
  CdmaPhoneCallState.PhoneCallState prevCdmaCallState=app.cdmaPhoneCallState.getPreviousCallState();
  if ((prevCdmaCallState == CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE) && (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.CONF_CALL)) {
    state=0;
  }
 else {
switch (c.getState()) {
case ACTIVE:
      if (index == 0) {
        state=mCdmaIsSecondCallActive ? 1 : 0;
      }
 else {
        state=mCdmaIsSecondCallActive ? 0 : 1;
      }
    break;
case HOLDING:
  state=1;
break;
case DIALING:
state=2;
break;
case ALERTING:
state=3;
break;
case INCOMING:
state=4;
break;
case WAITING:
state=5;
break;
default :
return null;
}
}
int mpty=0;
if (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.CONF_CALL) {
mpty=1;
}
 else {
mpty=0;
}
int direction=c.isIncoming() ? 1 : 0;
String number=c.getAddress();
int type=-1;
if (number != null) {
type=PhoneNumberUtils.toaFromString(number);
}
String result="String_Node_Str" + (index + 1) + "String_Node_Str"+ direction+ "String_Node_Str"+ state+ "String_Node_Str"+ mpty;
if (number != null) {
result+="String_Node_Str" + number + "String_Node_Str"+ type;
}
return result;
}
Program: 184741
Project: 184741
Buggy source:
/** 
 * Convert a Connection object into a single +CLCC result for CDMA phones 
 */
private String cdmaConnectionToClccEntry(int index,Connection c){
  int state;
  PhoneApp app=PhoneApp.getInstance();
  CdmaPhoneCallState.PhoneCallState currCdmaCallState=app.cdmaPhoneCallState.getCurrentCallState();
  CdmaPhoneCallState.PhoneCallState prevCdmaCallState=app.cdmaPhoneCallState.getPreviousCallState();
  if ((prevCdmaCallState == CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE) && (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.CONF_CALL)) {
    state=0;
  }
 else {
switch (c.getState()) {
case ACTIVE:
      if (index == 0) {
        state=mCdmaIsSecondCallActive ? 1 : 0;
      }
 else {
        state=mCdmaIsSecondCallActive ? 0 : 1;
      }
    break;
case HOLDING:
  state=1;
break;
case DIALING:
state=2;
break;
case ALERTING:
state=3;
break;
case INCOMING:
state=4;
break;
case WAITING:
state=5;
break;
default :
return null;
}
}
int mpty=0;
if (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.SINGLE_ACTIVE) {
mpty=0;
}
 else {
mpty=1;
}
int direction=c.isIncoming() ? 1 : 0;
String number=c.getAddress();
int type=-1;
if (number != null) {
type=PhoneNumberUtils.toaFromString(number);
}
String result="String_Node_Str" + (index + 1) + "String_Node_Str"+ direction+ "String_Node_Str"+ state+ "String_Node_Str"+ mpty;
if (number != null) {
result+="String_Node_Str" + number + "String_Node_Str"+ type;
}
return result;
}

Fixed version (ground truth):
/** 
 * Convert a Connection object into a single +CLCC result for CDMA phones 
 */
private String cdmaConnectionToClccEntry(int index,Connection c){
  int state;
  PhoneApp app=PhoneApp.getInstance();
  CdmaPhoneCallState.PhoneCallState currCdmaCallState=app.cdmaPhoneCallState.getCurrentCallState();
  CdmaPhoneCallState.PhoneCallState prevCdmaCallState=app.cdmaPhoneCallState.getPreviousCallState();
  if ((prevCdmaCallState == CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE) && (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.CONF_CALL)) {
    state=0;
  }
 else {
switch (c.getState()) {
case ACTIVE:
      if (index == 0) {
        state=mCdmaIsSecondCallActive ? 1 : 0;
      }
 else {
        state=mCdmaIsSecondCallActive ? 0 : 1;
      }
    break;
case HOLDING:
  state=1;
break;
case DIALING:
state=2;
break;
case ALERTING:
state=3;
break;
case INCOMING:
state=4;
break;
case WAITING:
state=5;
break;
default :
return null;
}
}
int mpty=0;
if (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.CONF_CALL) {
mpty=1;
}
 else {
mpty=0;
}
int direction=c.isIncoming() ? 1 : 0;
String number=c.getAddress();
int type=-1;
if (number != null) {
type=PhoneNumberUtils.toaFromString(number);
}
String result="String_Node_Str" + (index + 1) + "String_Node_Str"+ direction+ "String_Node_Str"+ state+ "String_Node_Str"+ mpty;
if (number != null) {
result+="String_Node_Str" + number + "String_Node_Str"+ type;
}
return result;
}
Program: 184742
Project: 184742
Buggy source:
/** 
 * Convert a Connection object into a single +CLCC result for CDMA phones 
 */
private String cdmaConnectionToClccEntry(int index,Connection c){
  int state;
  PhoneApp app=PhoneApp.getInstance();
  CdmaPhoneCallState.PhoneCallState currCdmaCallState=app.cdmaPhoneCallState.getCurrentCallState();
  CdmaPhoneCallState.PhoneCallState prevCdmaCallState=app.cdmaPhoneCallState.getPreviousCallState();
  if ((prevCdmaCallState == CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE) && (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.CONF_CALL)) {
    state=0;
  }
 else {
switch (c.getState()) {
case ACTIVE:
      if (index == 0) {
        state=mCdmaIsSecondCallActive ? 1 : 0;
      }
 else {
        state=mCdmaIsSecondCallActive ? 0 : 1;
      }
    break;
case HOLDING:
  state=1;
break;
case DIALING:
state=2;
break;
case ALERTING:
state=3;
break;
case INCOMING:
state=4;
break;
case WAITING:
state=5;
break;
default :
return null;
}
}
int mpty=0;
if (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.SINGLE_ACTIVE) {
mpty=0;
}
 else {
mpty=1;
}
int direction=c.isIncoming() ? 1 : 0;
String number=c.getAddress();
int type=-1;
if (number != null) {
type=PhoneNumberUtils.toaFromString(number);
}
String result="String_Node_Str" + (index + 1) + "String_Node_Str"+ direction+ "String_Node_Str"+ state+ "String_Node_Str"+ mpty;
if (number != null) {
result+="String_Node_Str" + number + "String_Node_Str"+ type;
}
return result;
}

Fixed version (ground truth):
/** 
 * Convert a Connection object into a single +CLCC result for CDMA phones 
 */
private String cdmaConnectionToClccEntry(int index,Connection c){
  int state;
  PhoneApp app=PhoneApp.getInstance();
  CdmaPhoneCallState.PhoneCallState currCdmaCallState=app.cdmaPhoneCallState.getCurrentCallState();
  CdmaPhoneCallState.PhoneCallState prevCdmaCallState=app.cdmaPhoneCallState.getPreviousCallState();
  if ((prevCdmaCallState == CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE) && (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.CONF_CALL)) {
    state=0;
  }
 else {
switch (c.getState()) {
case ACTIVE:
      if (index == 0) {
        state=mCdmaIsSecondCallActive ? 1 : 0;
      }
 else {
        state=mCdmaIsSecondCallActive ? 0 : 1;
      }
    break;
case HOLDING:
  state=1;
break;
case DIALING:
state=2;
break;
case ALERTING:
state=3;
break;
case INCOMING:
state=4;
break;
case WAITING:
state=5;
break;
default :
return null;
}
}
int mpty=0;
if (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.CONF_CALL) {
mpty=1;
}
 else {
mpty=0;
}
int direction=c.isIncoming() ? 1 : 0;
String number=c.getAddress();
int type=-1;
if (number != null) {
type=PhoneNumberUtils.toaFromString(number);
}
String result="String_Node_Str" + (index + 1) + "String_Node_Str"+ direction+ "String_Node_Str"+ state+ "String_Node_Str"+ mpty;
if (number != null) {
result+="String_Node_Str" + number + "String_Node_Str"+ type;
}
return result;
}
Program: 184743
Project: 184743
Buggy source:
/** 
 * Convert a Connection object into a single +CLCC result for CDMA phones 
 */
private String cdmaConnectionToClccEntry(int index,Connection c){
  int state;
  PhoneApp app=PhoneApp.getInstance();
  CdmaPhoneCallState.PhoneCallState currCdmaCallState=app.cdmaPhoneCallState.getCurrentCallState();
  CdmaPhoneCallState.PhoneCallState prevCdmaCallState=app.cdmaPhoneCallState.getPreviousCallState();
  if ((prevCdmaCallState == CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE) && (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.CONF_CALL)) {
    state=0;
  }
 else {
switch (c.getState()) {
case ACTIVE:
      if (index == 0) {
        state=mCdmaIsSecondCallActive ? 1 : 0;
      }
 else {
        state=mCdmaIsSecondCallActive ? 0 : 1;
      }
    break;
case HOLDING:
  state=1;
break;
case DIALING:
state=2;
break;
case ALERTING:
state=3;
break;
case INCOMING:
state=4;
break;
case WAITING:
state=5;
break;
default :
return null;
}
}
int mpty=0;
if (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.SINGLE_ACTIVE) {
mpty=0;
}
 else {
mpty=1;
}
int direction=c.isIncoming() ? 1 : 0;
String number=c.getAddress();
int type=-1;
if (number != null) {
type=PhoneNumberUtils.toaFromString(number);
}
String result="String_Node_Str" + (index + 1) + "String_Node_Str"+ direction+ "String_Node_Str"+ state+ "String_Node_Str"+ mpty;
if (number != null) {
result+="String_Node_Str" + number + "String_Node_Str"+ type;
}
return result;
}

Fixed version (ground truth):
/** 
 * Convert a Connection object into a single +CLCC result for CDMA phones 
 */
private String cdmaConnectionToClccEntry(int index,Connection c){
  int state;
  PhoneApp app=PhoneApp.getInstance();
  CdmaPhoneCallState.PhoneCallState currCdmaCallState=app.cdmaPhoneCallState.getCurrentCallState();
  CdmaPhoneCallState.PhoneCallState prevCdmaCallState=app.cdmaPhoneCallState.getPreviousCallState();
  if ((prevCdmaCallState == CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE) && (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.CONF_CALL)) {
    state=0;
  }
 else {
switch (c.getState()) {
case ACTIVE:
      if (index == 0) {
        state=mCdmaIsSecondCallActive ? 1 : 0;
      }
 else {
        state=mCdmaIsSecondCallActive ? 0 : 1;
      }
    break;
case HOLDING:
  state=1;
break;
case DIALING:
state=2;
break;
case ALERTING:
state=3;
break;
case INCOMING:
state=4;
break;
case WAITING:
state=5;
break;
default :
return null;
}
}
int mpty=0;
if (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.CONF_CALL) {
mpty=1;
}
 else {
mpty=0;
}
int direction=c.isIncoming() ? 1 : 0;
String number=c.getAddress();
int type=-1;
if (number != null) {
type=PhoneNumberUtils.toaFromString(number);
}
String result="String_Node_Str" + (index + 1) + "String_Node_Str"+ direction+ "String_Node_Str"+ state+ "String_Node_Str"+ mpty;
if (number != null) {
result+="String_Node_Str" + number + "String_Node_Str"+ type;
}
return result;
}
Program: 184744
Project: 184744
Buggy source:
/** 
 * Convert a Connection object into a single +CLCC result for CDMA phones 
 */
private String cdmaConnectionToClccEntry(int index,Connection c){
  int state;
  PhoneApp app=PhoneApp.getInstance();
  CdmaPhoneCallState.PhoneCallState currCdmaCallState=app.cdmaPhoneCallState.getCurrentCallState();
  CdmaPhoneCallState.PhoneCallState prevCdmaCallState=app.cdmaPhoneCallState.getPreviousCallState();
  if ((prevCdmaCallState == CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE) && (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.CONF_CALL)) {
    state=0;
  }
 else {
switch (c.getState()) {
case ACTIVE:
      if (index == 0) {
        state=mCdmaIsSecondCallActive ? 1 : 0;
      }
 else {
        state=mCdmaIsSecondCallActive ? 0 : 1;
      }
    break;
case HOLDING:
  state=1;
break;
case DIALING:
state=2;
break;
case ALERTING:
state=3;
break;
case INCOMING:
state=4;
break;
case WAITING:
state=5;
break;
default :
return null;
}
}
int mpty=0;
if (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.SINGLE_ACTIVE) {
mpty=0;
}
 else {
mpty=1;
}
int direction=c.isIncoming() ? 1 : 0;
String number=c.getAddress();
int type=-1;
if (number != null) {
type=PhoneNumberUtils.toaFromString(number);
}
String result="String_Node_Str" + (index + 1) + "String_Node_Str"+ direction+ "String_Node_Str"+ state+ "String_Node_Str"+ mpty;
if (number != null) {
result+="String_Node_Str" + number + "String_Node_Str"+ type;
}
return result;
}

Fixed version (ground truth):
/** 
 * Convert a Connection object into a single +CLCC result for CDMA phones 
 */
private String cdmaConnectionToClccEntry(int index,Connection c){
  int state;
  PhoneApp app=PhoneApp.getInstance();
  CdmaPhoneCallState.PhoneCallState currCdmaCallState=app.cdmaPhoneCallState.getCurrentCallState();
  CdmaPhoneCallState.PhoneCallState prevCdmaCallState=app.cdmaPhoneCallState.getPreviousCallState();
  if ((prevCdmaCallState == CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE) && (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.CONF_CALL)) {
    state=0;
  }
 else {
switch (c.getState()) {
case ACTIVE:
      if (index == 0) {
        state=mCdmaIsSecondCallActive ? 1 : 0;
      }
 else {
        state=mCdmaIsSecondCallActive ? 0 : 1;
      }
    break;
case HOLDING:
  state=1;
break;
case DIALING:
state=2;
break;
case ALERTING:
state=3;
break;
case INCOMING:
state=4;
break;
case WAITING:
state=5;
break;
default :
return null;
}
}
int mpty=0;
if (currCdmaCallState == CdmaPhoneCallState.PhoneCallState.CONF_CALL) {
mpty=1;
}
 else {
mpty=0;
}
int direction=c.isIncoming() ? 1 : 0;
String number=c.getAddress();
int type=-1;
if (number != null) {
type=PhoneNumberUtils.toaFromString(number);
}
String result="String_Node_Str" + (index + 1) + "String_Node_Str"+ direction+ "String_Node_Str"+ state+ "String_Node_Str"+ mpty;
if (number != null) {
result+="String_Node_Str" + number + "String_Node_Str"+ type;
}
return result;
}
Program: 184745
Project: 184745
Buggy source:
@Override public AtCommandResult handleReadCommand(){
  if ("String_Node_Str".equals(mCurrentPhonebook)) {
    return new AtCommandResult("String_Node_Str" + MAX_PHONEBOOK_SIZE);
  }
  PhonebookResult pbr=getPhonebookResult(mCurrentPhonebook,true);
  if (pbr == null) {
    return mHandsfree.reportCmeError(BluetoothCmeError.OPERATION_NOT_ALLOWED);
  }
  return new AtCommandResult("String_Node_Str" + mCurrentPhonebook + "String_Node_Str"+ pbr.cursor.getCount()+ "String_Node_Str"+ MAX_PHONEBOOK_SIZE);
}

Fixed version (ground truth):
@Override public AtCommandResult handleReadCommand(){
  if ("String_Node_Str".equals(mCurrentPhonebook)) {
    return new AtCommandResult("String_Node_Str" + getMaxPhoneBookSize(0));
  }
  PhonebookResult pbr=getPhonebookResult(mCurrentPhonebook,true);
  if (pbr == null) {
    return mHandsfree.reportCmeError(BluetoothCmeError.OPERATION_NOT_ALLOWED);
  }
  int size=pbr.cursor.getCount();
  return new AtCommandResult("String_Node_Str" + mCurrentPhonebook + "String_Node_Str"+ size+ "String_Node_Str"+ getMaxPhoneBookSize(size));
}