nus-yam/ex-repair huggingface dataset:
Program: 22037
Project: 22037
Buggy source:
public void dump(Printer pw,String prefix){
  pw.println(prefix + this);
  pw.println(prefix + "String_Node_Str" + mRun);
  pw.println(prefix + "String_Node_Str" + mThread);
  pw.println(prefix + "String_Node_Str" + ((mQueue != null) ? mQueue : "String_Node_Str"));
  if (mQueue != null) {
synchronized (mQueue) {
      Message msg=mQueue.mMessages;
      int n=0;
      while (msg != null) {
        pw.println(prefix + "String_Node_Str" + n+ "String_Node_Str"+ msg);
        n++;
        msg=msg.next;
      }
      pw.println(prefix + "String_Node_Str" + n+ "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void dump(Printer pw,String prefix){
  pw.println(prefix + this);
  pw.println(prefix + "String_Node_Str" + mRun);
  pw.println(prefix + "String_Node_Str" + mThread);
  pw.println(prefix + "String_Node_Str" + ((mQueue != null) ? mQueue : "String_Node_Str"));
  if (mQueue != null) {
synchronized (mQueue) {
      long now=SystemClock.uptimeMillis();
      Message msg=mQueue.mMessages;
      int n=0;
      while (msg != null) {
        pw.println(prefix + "String_Node_Str" + n+ "String_Node_Str"+ msg.toString(now));
        n++;
        msg=msg.next;
      }
      pw.println(prefix + "String_Node_Str" + n+ "String_Node_Str");
    }
  }
}
Program: 22038
Project: 22038
Buggy source:
public String toString(){
  StringBuilder b=new StringBuilder();
  b.append("String_Node_Str");
  b.append(what);
  b.append("String_Node_Str");
  b.append(when);
  if (arg1 != 0) {
    b.append("String_Node_Str");
    b.append(arg1);
  }
  if (arg2 != 0) {
    b.append("String_Node_Str");
    b.append(arg2);
  }
  if (obj != null) {
    b.append("String_Node_Str");
    b.append(obj);
  }
  b.append("String_Node_Str");
  return b.toString();
}

Fixed version (ground truth):
String toString(long now){
  StringBuilder b=new StringBuilder();
  b.append("String_Node_Str");
  b.append(what);
  b.append("String_Node_Str");
  TimeUtils.formatDuration(when - now,b);
  if (arg1 != 0) {
    b.append("String_Node_Str");
    b.append(arg1);
  }
  if (arg2 != 0) {
    b.append("String_Node_Str");
    b.append(arg2);
  }
  if (obj != null) {
    b.append("String_Node_Str");
    b.append(obj);
  }
  b.append("String_Node_Str");
  return b.toString();
}
Program: 22039
Project: 22039
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ImageView content=new ImageView(this);
  content.setImageResource(com.android.internal.R.drawable.platlogo);
  content.setScaleType(ImageView.ScaleType.FIT_CENTER);
  setContentView(content);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mToast=Toast.makeText(this,"String_Node_Str",Toast.LENGTH_SHORT);
  ImageView content=new ImageView(this);
  content.setImageResource(com.android.internal.R.drawable.platlogo);
  content.setScaleType(ImageView.ScaleType.FIT_CENTER);
  setContentView(content);
}
Program: 22040
Project: 22040
Buggy source:
public void noteScreenOnLocked(){
  if (!mScreenOn) {
    mHistoryCur.states|=HistoryItem.STATE_SCREEN_ON_FLAG;
    if (DEBUG_HISTORY)     Slog.v(TAG,"String_Node_Str" + Integer.toHexString(mHistoryCur.states));
    addHistoryRecordLocked(SystemClock.elapsedRealtime());
    mScreenOn=true;
    mScreenOnTimer.startRunningLocked(this);
    if (mScreenBrightnessBin >= 0) {
      mScreenBrightnessTimer[mScreenBrightnessBin].startRunningLocked(this);
    }
    noteStartWakeLocked(-1,-1,"String_Node_Str",0);
  }
}

Fixed version (ground truth):
public void noteScreenOnLocked(){
  if (!mScreenOn) {
    mHistoryCur.states|=HistoryItem.STATE_SCREEN_ON_FLAG;
    if (DEBUG_HISTORY)     Slog.v(TAG,"String_Node_Str" + Integer.toHexString(mHistoryCur.states));
    addHistoryRecordLocked(SystemClock.elapsedRealtime());
    mScreenOn=true;
    mScreenOnTimer.startRunningLocked(this);
    if (mScreenBrightnessBin >= 0) {
      mScreenBrightnessTimer[mScreenBrightnessBin].startRunningLocked(this);
    }
    noteStartWakeLocked(-1,-1,"String_Node_Str",WAKE_TYPE_PARTIAL);
  }
}
Program: 22041
Project: 22041
Buggy source:
public void noteStartWakeLocked(int pid,String name,int type){
  StopwatchTimer t=getWakeTimerLocked(name,type);
  if (t != null) {
    t.startRunningLocked(BatteryStatsImpl.this);
  }
  if (pid >= 0) {
    Pid p=getPidStatsLocked(pid);
    p.mWakeStart=SystemClock.elapsedRealtime();
  }
}

Fixed version (ground truth):
public void noteStartWakeLocked(int pid,String name,int type){
  StopwatchTimer t=getWakeTimerLocked(name,type);
  if (t != null) {
    t.startRunningLocked(BatteryStatsImpl.this);
  }
  if (pid >= 0 && type == WAKE_TYPE_PARTIAL) {
    Pid p=getPidStatsLocked(pid);
    p.mWakeStart=SystemClock.elapsedRealtime();
  }
}
Program: 22042
Project: 22042
Buggy source:
public void noteStopWakeLocked(int pid,String name,int type){
  StopwatchTimer t=getWakeTimerLocked(name,type);
  if (t != null) {
    t.stopRunningLocked(BatteryStatsImpl.this);
  }
  if (pid >= 0) {
    Pid p=mPids.get(pid);
    if (p != null) {
      p.mWakeSum+=SystemClock.elapsedRealtime() - p.mWakeStart;
      p.mWakeStart=0;
    }
  }
}

Fixed version (ground truth):
public void noteStopWakeLocked(int pid,String name,int type){
  StopwatchTimer t=getWakeTimerLocked(name,type);
  if (t != null) {
    t.stopRunningLocked(BatteryStatsImpl.this);
  }
  if (pid >= 0 && type == WAKE_TYPE_PARTIAL) {
    Pid p=mPids.get(pid);
    if (p != null) {
      p.mWakeSum+=SystemClock.elapsedRealtime() - p.mWakeStart;
      p.mWakeStart=0;
    }
  }
}
Program: 22043
Project: 22043
Buggy source:
public void noteScreenOffLocked(){
  if (mScreenOn) {
    mHistoryCur.states&=~HistoryItem.STATE_SCREEN_ON_FLAG;
    if (DEBUG_HISTORY)     Slog.v(TAG,"String_Node_Str" + Integer.toHexString(mHistoryCur.states));
    addHistoryRecordLocked(SystemClock.elapsedRealtime());
    mScreenOn=false;
    mScreenOnTimer.stopRunningLocked(this);
    if (mScreenBrightnessBin >= 0) {
      mScreenBrightnessTimer[mScreenBrightnessBin].stopRunningLocked(this);
    }
    noteStopWakeLocked(-1,-1,"String_Node_Str",0);
  }
}

Fixed version (ground truth):
public void noteScreenOffLocked(){
  if (mScreenOn) {
    mHistoryCur.states&=~HistoryItem.STATE_SCREEN_ON_FLAG;
    if (DEBUG_HISTORY)     Slog.v(TAG,"String_Node_Str" + Integer.toHexString(mHistoryCur.states));
    addHistoryRecordLocked(SystemClock.elapsedRealtime());
    mScreenOn=false;
    mScreenOnTimer.stopRunningLocked(this);
    if (mScreenBrightnessBin >= 0) {
      mScreenBrightnessTimer[mScreenBrightnessBin].stopRunningLocked(this);
    }
    noteStopWakeLocked(-1,-1,"String_Node_Str",WAKE_TYPE_PARTIAL);
  }
}
Program: 22044
Project: 22044
Buggy source:
/** 
 * Get an SMS-SUBMIT PDU for a data message to a destination address &amp; port
 * @param destAddr the address of the destination for the message
 * @param userDara the data for the message
 * @param statusReportRequested Indicates whether a report is requested for this message.
 * @return a <code>SubmitPdu</code> containing the encoded SCaddress, if applicable, and the encoded message. Returns null on encode error.
 */
public static SubmitPdu getSubmitPdu(String destAddr,UserData userData,boolean statusReportRequested){
  return privateGetSubmitPdu(destAddr,statusReportRequested,userData);
}

Fixed version (ground truth):
/** 
 * Get an SMS-SUBMIT PDU for a data message to a destination address &amp; port
 * @param destAddr the address of the destination for the message
 * @param userData the data for the message
 * @param statusReportRequested Indicates whether a report is requested for this message.
 * @return a <code>SubmitPdu</code> containing the encoded SCaddress, if applicable, and the encoded message. Returns null on encode error.
 */
public static SubmitPdu getSubmitPdu(String destAddr,UserData userData,boolean statusReportRequested){
  return privateGetSubmitPdu(destAddr,statusReportRequested,userData);
}
Program: 22045
Project: 22045
Buggy source:
/** 
 * Calculate the number of septets needed to encode the message.
 * @param messageBody the message to encode
 * @param use7bitOnly ignore (but still count) illegal characters if true
 * @return TextEncodingDetails
 */
public static TextEncodingDetails calculateLength(CharSequence messageBody,boolean use7bitOnly){
  return BearerData.calcTextEncodingDetails(messageBody.toString(),use7bitOnly);
}

Fixed version (ground truth):
/** 
 * Calculate the number of septets needed to encode the message.
 * @param messageBody the message to encode
 * @param use7bitOnly ignore (but still count) illegal characters if true
 * @return TextEncodingDetails
 */
public static TextEncodingDetails calculateLength(CharSequence messageBody,boolean use7bitOnly){
  return BearerData.calcTextEncodingDetails(messageBody,use7bitOnly);
}
Program: 22047
Project: 22047
Buggy source:
/** 
 * Calculate the message text encoding length, fragmentation, and other details.
 * @param force ignore (but still count) illegal characters if true
 * @return septet count, or -1 on failure
 */
public static TextEncodingDetails calcTextEncodingDetails(CharSequence msg,boolean force7BitEncoding){
  TextEncodingDetails ted;
  int septets=countAsciiSeptets(msg,force7BitEncoding);
  if (septets != -1 && septets <= SmsMessage.MAX_USER_DATA_SEPTETS) {
    ted=new TextEncodingDetails();
    ted.msgCount=1;
    ted.codeUnitCount=septets;
    ted.codeUnitsRemaining=SmsMessage.MAX_USER_DATA_SEPTETS - septets;
    ted.codeUnitSize=SmsMessage.ENCODING_7BIT;
  }
 else {
    ted=com.android.internal.telephony.gsm.SmsMessage.calculateLength(msg,force7BitEncoding);
    if (ted.msgCount == 1 && ted.codeUnitSize == SmsMessage.ENCODING_7BIT) {
      ted.codeUnitCount=msg.length();
      int octets=ted.codeUnitCount * 2;
      if (octets > MAX_USER_DATA_BYTES) {
        ted.msgCount=(octets / MAX_USER_DATA_BYTES_WITH_HEADER) + 1;
        ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES_WITH_HEADER - (octets % MAX_USER_DATA_BYTES_WITH_HEADER)) / 2;
      }
 else {
        ted.msgCount=1;
        ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES - octets) / 2;
      }
      ted.codeUnitSize=ENCODING_16BIT;
    }
  }
  return ted;
}

Fixed version (ground truth):
/** 
 * Calculate the message text encoding length, fragmentation, and other details.
 * @param msg message text
 * @param force7BitEncoding ignore (but still count) illegal characters if true
 * @return septet count, or -1 on failure
 */
public static TextEncodingDetails calcTextEncodingDetails(CharSequence msg,boolean force7BitEncoding){
  TextEncodingDetails ted;
  int septets=countAsciiSeptets(msg,force7BitEncoding);
  if (septets != -1 && septets <= SmsMessage.MAX_USER_DATA_SEPTETS) {
    ted=new TextEncodingDetails();
    ted.msgCount=1;
    ted.codeUnitCount=septets;
    ted.codeUnitsRemaining=SmsMessage.MAX_USER_DATA_SEPTETS - septets;
    ted.codeUnitSize=SmsMessage.ENCODING_7BIT;
  }
 else {
    ted=com.android.internal.telephony.gsm.SmsMessage.calculateLength(msg,force7BitEncoding);
    if (ted.msgCount == 1 && ted.codeUnitSize == SmsMessage.ENCODING_7BIT) {
      ted.codeUnitCount=msg.length();
      int octets=ted.codeUnitCount * 2;
      if (octets > MAX_USER_DATA_BYTES) {
        ted.msgCount=(octets + (MAX_USER_DATA_BYTES_WITH_HEADER - 1)) / MAX_USER_DATA_BYTES_WITH_HEADER;
        ted.codeUnitsRemaining=((ted.msgCount * MAX_USER_DATA_BYTES_WITH_HEADER) - octets) / 2;
      }
 else {
        ted.msgCount=1;
        ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES - octets) / 2;
      }
      ted.codeUnitSize=ENCODING_16BIT;
    }
  }
  return ted;
}
Program: 22048
Project: 22048
Buggy source:
/** 
 * Calculate the number of septets needed to encode the message.
 * @param msgBody the message to encode
 * @param use7bitOnly ignore (but still count) illegal characters if true
 * @return TextEncodingDetails
 */
public static TextEncodingDetails calculateLength(CharSequence msgBody,boolean use7bitOnly){
  TextEncodingDetails ted=new TextEncodingDetails();
  try {
    int septets=GsmAlphabet.countGsmSeptets(msgBody,!use7bitOnly);
    ted.codeUnitCount=septets;
    if (septets > MAX_USER_DATA_SEPTETS) {
      ted.msgCount=(septets / MAX_USER_DATA_SEPTETS_WITH_HEADER) + 1;
      ted.codeUnitsRemaining=MAX_USER_DATA_SEPTETS_WITH_HEADER - (septets % MAX_USER_DATA_SEPTETS_WITH_HEADER);
    }
 else {
      ted.msgCount=1;
      ted.codeUnitsRemaining=MAX_USER_DATA_SEPTETS - septets;
    }
    ted.codeUnitSize=ENCODING_7BIT;
  }
 catch (  EncodeException ex) {
    int octets=msgBody.length() * 2;
    ted.codeUnitCount=msgBody.length();
    if (octets > MAX_USER_DATA_BYTES) {
      ted.msgCount=(octets / MAX_USER_DATA_BYTES_WITH_HEADER) + 1;
      ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES_WITH_HEADER - (octets % MAX_USER_DATA_BYTES_WITH_HEADER)) / 2;
    }
 else {
      ted.msgCount=1;
      ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES - octets) / 2;
    }
    ted.codeUnitSize=ENCODING_16BIT;
  }
  return ted;
}

Fixed version (ground truth):
/** 
 * Calculate the number of septets needed to encode the message.
 * @param msgBody the message to encode
 * @param use7bitOnly ignore (but still count) illegal characters if true
 * @return TextEncodingDetails
 */
public static TextEncodingDetails calculateLength(CharSequence msgBody,boolean use7bitOnly){
  TextEncodingDetails ted=new TextEncodingDetails();
  try {
    int septets=GsmAlphabet.countGsmSeptets(msgBody,!use7bitOnly);
    ted.codeUnitCount=septets;
    if (septets > MAX_USER_DATA_SEPTETS) {
      ted.msgCount=(septets + (MAX_USER_DATA_SEPTETS_WITH_HEADER - 1)) / MAX_USER_DATA_SEPTETS_WITH_HEADER;
      ted.codeUnitsRemaining=(ted.msgCount * MAX_USER_DATA_SEPTETS_WITH_HEADER) - septets;
    }
 else {
      ted.msgCount=1;
      ted.codeUnitsRemaining=MAX_USER_DATA_SEPTETS - septets;
    }
    ted.codeUnitSize=ENCODING_7BIT;
  }
 catch (  EncodeException ex) {
    int octets=msgBody.length() * 2;
    ted.codeUnitCount=msgBody.length();
    if (octets > MAX_USER_DATA_BYTES) {
      ted.msgCount=(octets + (MAX_USER_DATA_BYTES_WITH_HEADER - 1)) / MAX_USER_DATA_BYTES_WITH_HEADER;
      ted.codeUnitsRemaining=((ted.msgCount * MAX_USER_DATA_BYTES_WITH_HEADER) - octets) / 2;
    }
 else {
      ted.msgCount=1;
      ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES - octets) / 2;
    }
    ted.codeUnitSize=ENCODING_16BIT;
  }
  return ted;
}
Program: 22049
Project: 22049
Buggy source:
/** 
 * Get an SMS-SUBMIT PDU for a data message to a destination address &amp; port
 * @param destAddr the address of the destination for the message
 * @param userDara the data for the message
 * @param statusReportRequested Indicates whether a report is requested for this message.
 * @return a <code>SubmitPdu</code> containing the encoded SCaddress, if applicable, and the encoded message. Returns null on encode error.
 */
public static SubmitPdu getSubmitPdu(String destAddr,UserData userData,boolean statusReportRequested){
  return privateGetSubmitPdu(destAddr,statusReportRequested,userData);
}

Fixed version (ground truth):
/** 
 * Get an SMS-SUBMIT PDU for a data message to a destination address &amp; port
 * @param destAddr the address of the destination for the message
 * @param userData the data for the message
 * @param statusReportRequested Indicates whether a report is requested for this message.
 * @return a <code>SubmitPdu</code> containing the encoded SCaddress, if applicable, and the encoded message. Returns null on encode error.
 */
public static SubmitPdu getSubmitPdu(String destAddr,UserData userData,boolean statusReportRequested){
  return privateGetSubmitPdu(destAddr,statusReportRequested,userData);
}
Program: 22050
Project: 22050
Buggy source:
/** 
 * Calculate the number of septets needed to encode the message.
 * @param messageBody the message to encode
 * @param use7bitOnly ignore (but still count) illegal characters if true
 * @return TextEncodingDetails
 */
public static TextEncodingDetails calculateLength(CharSequence messageBody,boolean use7bitOnly){
  return BearerData.calcTextEncodingDetails(messageBody.toString(),use7bitOnly);
}

Fixed version (ground truth):
/** 
 * Calculate the number of septets needed to encode the message.
 * @param messageBody the message to encode
 * @param use7bitOnly ignore (but still count) illegal characters if true
 * @return TextEncodingDetails
 */
public static TextEncodingDetails calculateLength(CharSequence messageBody,boolean use7bitOnly){
  return BearerData.calcTextEncodingDetails(messageBody,use7bitOnly);
}
Program: 22052
Project: 22052
Buggy source:
/** 
 * Calculate the message text encoding length, fragmentation, and other details.
 * @param force ignore (but still count) illegal characters if true
 * @return septet count, or -1 on failure
 */
public static TextEncodingDetails calcTextEncodingDetails(CharSequence msg,boolean force7BitEncoding){
  TextEncodingDetails ted;
  int septets=countAsciiSeptets(msg,force7BitEncoding);
  if (septets != -1 && septets <= SmsMessage.MAX_USER_DATA_SEPTETS) {
    ted=new TextEncodingDetails();
    ted.msgCount=1;
    ted.codeUnitCount=septets;
    ted.codeUnitsRemaining=SmsMessage.MAX_USER_DATA_SEPTETS - septets;
    ted.codeUnitSize=SmsMessage.ENCODING_7BIT;
  }
 else {
    ted=com.android.internal.telephony.gsm.SmsMessage.calculateLength(msg,force7BitEncoding);
    if (ted.msgCount == 1 && ted.codeUnitSize == SmsMessage.ENCODING_7BIT) {
      ted.codeUnitCount=msg.length();
      int octets=ted.codeUnitCount * 2;
      if (octets > MAX_USER_DATA_BYTES) {
        ted.msgCount=(octets / MAX_USER_DATA_BYTES_WITH_HEADER) + 1;
        ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES_WITH_HEADER - (octets % MAX_USER_DATA_BYTES_WITH_HEADER)) / 2;
      }
 else {
        ted.msgCount=1;
        ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES - octets) / 2;
      }
      ted.codeUnitSize=ENCODING_16BIT;
    }
  }
  return ted;
}

Fixed version (ground truth):
/** 
 * Calculate the message text encoding length, fragmentation, and other details.
 * @param msg message text
 * @param force7BitEncoding ignore (but still count) illegal characters if true
 * @return septet count, or -1 on failure
 */
public static TextEncodingDetails calcTextEncodingDetails(CharSequence msg,boolean force7BitEncoding){
  TextEncodingDetails ted;
  int septets=countAsciiSeptets(msg,force7BitEncoding);
  if (septets != -1 && septets <= SmsMessage.MAX_USER_DATA_SEPTETS) {
    ted=new TextEncodingDetails();
    ted.msgCount=1;
    ted.codeUnitCount=septets;
    ted.codeUnitsRemaining=SmsMessage.MAX_USER_DATA_SEPTETS - septets;
    ted.codeUnitSize=SmsMessage.ENCODING_7BIT;
  }
 else {
    ted=com.android.internal.telephony.gsm.SmsMessage.calculateLength(msg,force7BitEncoding);
    if (ted.msgCount == 1 && ted.codeUnitSize == SmsMessage.ENCODING_7BIT) {
      ted.codeUnitCount=msg.length();
      int octets=ted.codeUnitCount * 2;
      if (octets > MAX_USER_DATA_BYTES) {
        ted.msgCount=(octets + (MAX_USER_DATA_BYTES_WITH_HEADER - 1)) / MAX_USER_DATA_BYTES_WITH_HEADER;
        ted.codeUnitsRemaining=((ted.msgCount * MAX_USER_DATA_BYTES_WITH_HEADER) - octets) / 2;
      }
 else {
        ted.msgCount=1;
        ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES - octets) / 2;
      }
      ted.codeUnitSize=ENCODING_16BIT;
    }
  }
  return ted;
}
Program: 22053
Project: 22053
Buggy source:
/** 
 * Calculate the number of septets needed to encode the message.
 * @param msgBody the message to encode
 * @param use7bitOnly ignore (but still count) illegal characters if true
 * @return TextEncodingDetails
 */
public static TextEncodingDetails calculateLength(CharSequence msgBody,boolean use7bitOnly){
  TextEncodingDetails ted=new TextEncodingDetails();
  try {
    int septets=GsmAlphabet.countGsmSeptets(msgBody,!use7bitOnly);
    ted.codeUnitCount=septets;
    if (septets > MAX_USER_DATA_SEPTETS) {
      ted.msgCount=(septets / MAX_USER_DATA_SEPTETS_WITH_HEADER) + 1;
      ted.codeUnitsRemaining=MAX_USER_DATA_SEPTETS_WITH_HEADER - (septets % MAX_USER_DATA_SEPTETS_WITH_HEADER);
    }
 else {
      ted.msgCount=1;
      ted.codeUnitsRemaining=MAX_USER_DATA_SEPTETS - septets;
    }
    ted.codeUnitSize=ENCODING_7BIT;
  }
 catch (  EncodeException ex) {
    int octets=msgBody.length() * 2;
    ted.codeUnitCount=msgBody.length();
    if (octets > MAX_USER_DATA_BYTES) {
      ted.msgCount=(octets / MAX_USER_DATA_BYTES_WITH_HEADER) + 1;
      ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES_WITH_HEADER - (octets % MAX_USER_DATA_BYTES_WITH_HEADER)) / 2;
    }
 else {
      ted.msgCount=1;
      ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES - octets) / 2;
    }
    ted.codeUnitSize=ENCODING_16BIT;
  }
  return ted;
}

Fixed version (ground truth):
/** 
 * Calculate the number of septets needed to encode the message.
 * @param msgBody the message to encode
 * @param use7bitOnly ignore (but still count) illegal characters if true
 * @return TextEncodingDetails
 */
public static TextEncodingDetails calculateLength(CharSequence msgBody,boolean use7bitOnly){
  TextEncodingDetails ted=new TextEncodingDetails();
  try {
    int septets=GsmAlphabet.countGsmSeptets(msgBody,!use7bitOnly);
    ted.codeUnitCount=septets;
    if (septets > MAX_USER_DATA_SEPTETS) {
      ted.msgCount=(septets + (MAX_USER_DATA_SEPTETS_WITH_HEADER - 1)) / MAX_USER_DATA_SEPTETS_WITH_HEADER;
      ted.codeUnitsRemaining=(ted.msgCount * MAX_USER_DATA_SEPTETS_WITH_HEADER) - septets;
    }
 else {
      ted.msgCount=1;
      ted.codeUnitsRemaining=MAX_USER_DATA_SEPTETS - septets;
    }
    ted.codeUnitSize=ENCODING_7BIT;
  }
 catch (  EncodeException ex) {
    int octets=msgBody.length() * 2;
    ted.codeUnitCount=msgBody.length();
    if (octets > MAX_USER_DATA_BYTES) {
      ted.msgCount=(octets + (MAX_USER_DATA_BYTES_WITH_HEADER - 1)) / MAX_USER_DATA_BYTES_WITH_HEADER;
      ted.codeUnitsRemaining=((ted.msgCount * MAX_USER_DATA_BYTES_WITH_HEADER) - octets) / 2;
    }
 else {
      ted.msgCount=1;
      ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES - octets) / 2;
    }
    ted.codeUnitSize=ENCODING_16BIT;
  }
  return ted;
}
Program: 22054
Project: 22054
Buggy source:
/** 
 * Retrieves the compelete voice mail number.
 * @hide
 */
public String getCompleteVoiceMailNumber(){
  mContext.enforceCallingOrSelfPermission(CALL_PRIVILEGED,"String_Node_Str");
  String number=mPhone.getVoiceMailNumber();
  Log.d(LOG_TAG,"String_Node_Str");
  return number;
}

Fixed version (ground truth):
/** 
 * Retrieves the complete voice mail number.
 * @hide
 */
public String getCompleteVoiceMailNumber(){
  mContext.enforceCallingOrSelfPermission(CALL_PRIVILEGED,"String_Node_Str");
  String number=mPhone.getVoiceMailNumber();
  Log.d(LOG_TAG,"String_Node_Str");
  return number;
}
Program: 22055
Project: 22055
Buggy source:
/** 
 * response.obj.result is an String[14] See ril.h for details Please note that registration state 4 ("unknown") is treated as "out of service" above
 */
public void getRegistrationState(Message result){
  String ret[]=new String[14];
  ret[0]="String_Node_Str";
  ret[1]=null;
  ret[2]=null;
  ret[3]=null;
  ret[4]=null;
  ret[5]=null;
  ret[6]=null;
  ret[7]=null;
  ret[8]=null;
  ret[9]=null;
  ret[10]=null;
  ret[11]=null;
  ret[12]=null;
  ret[13]=null;
  ret[14]=null;
  resultSuccess(result,ret);
}

Fixed version (ground truth):
/** 
 * response.obj.result is an String[14] See ril.h for details Please note that registration state 4 ("unknown") is treated as "out of service" above
 */
public void getRegistrationState(Message result){
  String ret[]=new String[14];
  ret[0]="String_Node_Str";
  ret[1]=null;
  ret[2]=null;
  ret[3]=null;
  ret[4]=null;
  ret[5]=null;
  ret[6]=null;
  ret[7]=null;
  ret[8]=null;
  ret[9]=null;
  ret[10]=null;
  ret[11]=null;
  ret[12]=null;
  ret[13]=null;
  resultSuccess(result,ret);
}
Program: 22056
Project: 22056
Buggy source:
public void dispatchKey(KeyEvent event){
  if (event.getAction() == KeyEvent.ACTION_DOWN) {
    if (false && event.getKeyCode() == KeyEvent.KEYCODE_CAMERA) {
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
      debug();
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
    }
  }
  Message msg=obtainMessage(DISPATCH_KEY);
  msg.obj=event;
  if (LOCAL_LOGV)   Log.v(TAG,"String_Node_Str" + event + "String_Node_Str"+ mView);
  sendMessageAtTime(msg,event.getEventTime());
}

Fixed version (ground truth):
private void dispatchKey(KeyEvent event,boolean sendDone){
  if (false && event.getAction() == KeyEvent.ACTION_DOWN) {
    if (event.getKeyCode() == KeyEvent.KEYCODE_CAMERA) {
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
      debug();
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
    }
  }
  Message msg=obtainMessage(DISPATCH_KEY);
  msg.obj=event;
  msg.arg1=sendDone ? 1 : 0;
  if (LOCAL_LOGV)   Log.v(TAG,"String_Node_Str" + event + "String_Node_Str"+ mView);
  sendMessageAtTime(msg,event.getEventTime());
}
Program: 22057
Project: 22057
Buggy source:
private void deliverKeyEvent(KeyEvent event,boolean sendDone){
  boolean handled=mView != null ? mView.dispatchKeyEventPreIme(event) : true;
  if (handled) {
    if (sendDone) {
      if (LOCAL_LOGV)       Log.v(TAG,"String_Node_Str");
      finishKeyEvent(event);
    }
    return;
  }
  if (mLastWasImTarget) {
    InputMethodManager imm=InputMethodManager.peekInstance();
    if (imm != null && mView != null) {
      int seq=enqueuePendingEvent(event,sendDone);
      if (DEBUG_IMF)       Log.v(TAG,"String_Node_Str" + seq + "String_Node_Str"+ event);
      imm.dispatchKeyEvent(mView.getContext(),seq,event,mInputMethodCallback);
      return;
    }
  }
  deliverKeyEventToViewHierarchy(event,sendDone);
}

Fixed version (ground truth):
private void deliverKeyEvent(KeyEvent event,boolean sendDone){
  boolean handled=mView != null ? mView.dispatchKeyEventPreIme(event) : true;
  if (handled) {
    if (sendDone) {
      finishKeyEvent(event);
    }
    return;
  }
  if (mLastWasImTarget) {
    InputMethodManager imm=InputMethodManager.peekInstance();
    if (imm != null && mView != null) {
      int seq=enqueuePendingEvent(event,sendDone);
      if (DEBUG_IMF)       Log.v(TAG,"String_Node_Str" + seq + "String_Node_Str"+ event);
      imm.dispatchKeyEvent(mView.getContext(),seq,event,mInputMethodCallback);
      return;
    }
  }
  deliverKeyEventToViewHierarchy(event,sendDone);
}
Program: 22058
Project: 22058
Buggy source:
void handleFinishedEvent(int seq,boolean handled){
  final KeyEvent event=(KeyEvent)retrievePendingEvent(seq);
  if (DEBUG_IMF)   Log.v(TAG,"String_Node_Str" + seq + "String_Node_Str"+ handled+ "String_Node_Str"+ event);
  if (event != null) {
    final boolean sendDone=seq >= 0;
    if (!handled) {
      deliverKeyEventToViewHierarchy(event,sendDone);
      return;
    }
 else     if (sendDone) {
      if (LOCAL_LOGV)       Log.v(TAG,"String_Node_Str");
      finishKeyEvent(event);
    }
 else {
      Log.w(TAG,"String_Node_Str" + seq + "String_Node_Str"+ handled+ "String_Node_Str"+ event+ "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
void handleFinishedEvent(int seq,boolean handled){
  final KeyEvent event=(KeyEvent)retrievePendingEvent(seq);
  if (DEBUG_IMF)   Log.v(TAG,"String_Node_Str" + seq + "String_Node_Str"+ handled+ "String_Node_Str"+ event);
  if (event != null) {
    final boolean sendDone=seq >= 0;
    if (!handled) {
      deliverKeyEventToViewHierarchy(event,sendDone);
      return;
    }
 else     if (sendDone) {
      finishKeyEvent(event);
    }
 else {
      Log.w(TAG,"String_Node_Str" + seq + "String_Node_Str"+ handled+ "String_Node_Str"+ event+ "String_Node_Str");
    }
  }
}
Program: 22059
Project: 22059
Buggy source:
private void finishKeyEvent(KeyEvent event){
  if (mFinishedCallback != null) {
    mFinishedCallback.run();
    mFinishedCallback=null;
  }
}

Fixed version (ground truth):
private void finishKeyEvent(KeyEvent event){
  if (LOCAL_LOGV)   Log.v(TAG,"String_Node_Str");
  if (mFinishedCallback != null) {
    mFinishedCallback.run();
    mFinishedCallback=null;
  }
 else {
    Slog.w(TAG,"String_Node_Str" + "String_Node_Str");
  }
}
Program: 22060
Project: 22060
Buggy source:
public void handleKey(KeyEvent event,Runnable finishedCallback){
  mFinishedCallback=finishedCallback;
  dispatchKey(event);
}

Fixed version (ground truth):
public void handleKey(KeyEvent event,Runnable finishedCallback){
  if (mFinishedCallback != null) {
    Slog.w(TAG,"String_Node_Str" + "String_Node_Str");
  }
  mFinishedCallback=finishedCallback;
  dispatchKey(event,true);
}
Program: 22061
Project: 22061
Buggy source:
private void deliverKeyEventToViewHierarchy(KeyEvent event,boolean sendDone){
  try {
    if (mView != null && mAdded) {
      final int action=event.getAction();
      boolean isDown=(action == KeyEvent.ACTION_DOWN);
      if (checkForLeavingTouchModeAndConsume(event)) {
        return;
      }
      if (Config.LOGV) {
        captureKeyLog("String_Node_Str",event);
      }
      boolean keyHandled=mView.dispatchKeyEvent(event);
      if (!keyHandled && isDown) {
        int direction=0;
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_DPAD_LEFT:
          direction=View.FOCUS_LEFT;
        break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
      direction=View.FOCUS_RIGHT;
    break;
case KeyEvent.KEYCODE_DPAD_UP:
  direction=View.FOCUS_UP;
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
direction=View.FOCUS_DOWN;
break;
}
if (direction != 0) {
View focused=mView != null ? mView.findFocus() : null;
if (focused != null) {
View v=focused.focusSearch(direction);
boolean focusPassed=false;
if (v != null && v != focused) {
focused.getFocusedRect(mTempRect);
if (mView instanceof ViewGroup) {
((ViewGroup)mView).offsetDescendantRectToMyCoords(focused,mTempRect);
((ViewGroup)mView).offsetRectIntoDescendantCoords(v,mTempRect);
}
focusPassed=v.requestFocus(direction,mTempRect);
}
if (!focusPassed) {
mView.dispatchUnhandledMove(focused,direction);
}
 else {
playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));
}
}
}
}
}
}
  finally {
if (sendDone) {
if (LOCAL_LOGV) Log.v(TAG,"String_Node_Str");
finishKeyEvent(event);
}
}
}

Fixed version (ground truth):
private void deliverKeyEventToViewHierarchy(KeyEvent event,boolean sendDone){
  try {
    if (mView != null && mAdded) {
      final int action=event.getAction();
      boolean isDown=(action == KeyEvent.ACTION_DOWN);
      if (checkForLeavingTouchModeAndConsume(event)) {
        return;
      }
      if (Config.LOGV) {
        captureKeyLog("String_Node_Str",event);
      }
      boolean keyHandled=mView.dispatchKeyEvent(event);
      if (!keyHandled && isDown) {
        int direction=0;
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_DPAD_LEFT:
          direction=View.FOCUS_LEFT;
        break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
      direction=View.FOCUS_RIGHT;
    break;
case KeyEvent.KEYCODE_DPAD_UP:
  direction=View.FOCUS_UP;
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
direction=View.FOCUS_DOWN;
break;
}
if (direction != 0) {
View focused=mView != null ? mView.findFocus() : null;
if (focused != null) {
View v=focused.focusSearch(direction);
boolean focusPassed=false;
if (v != null && v != focused) {
focused.getFocusedRect(mTempRect);
if (mView instanceof ViewGroup) {
((ViewGroup)mView).offsetDescendantRectToMyCoords(focused,mTempRect);
((ViewGroup)mView).offsetRectIntoDescendantCoords(v,mTempRect);
}
focusPassed=v.requestFocus(direction,mTempRect);
}
if (!focusPassed) {
mView.dispatchUnhandledMove(focused,direction);
}
 else {
playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));
}
}
}
}
}
}
  finally {
if (sendDone) {
finishKeyEvent(event);
}
}
}
Program: 22063
Project: 22063
Buggy source:
public void dispatchKey(KeyEvent event){
  if (event.getAction() == KeyEvent.ACTION_DOWN) {
    if (false && event.getKeyCode() == KeyEvent.KEYCODE_CAMERA) {
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
      debug();
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
    }
  }
  Message msg=obtainMessage(DISPATCH_KEY);
  msg.obj=event;
  if (LOCAL_LOGV)   Log.v(TAG,"String_Node_Str" + event + "String_Node_Str"+ mView);
  sendMessageAtTime(msg,event.getEventTime());
}

Fixed version (ground truth):
private void dispatchKey(KeyEvent event,boolean sendDone){
  if (false && event.getAction() == KeyEvent.ACTION_DOWN) {
    if (event.getKeyCode() == KeyEvent.KEYCODE_CAMERA) {
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
      debug();
      if (Config.LOGD)       Log.d("String_Node_Str","String_Node_Str");
    }
  }
  Message msg=obtainMessage(DISPATCH_KEY);
  msg.obj=event;
  msg.arg1=sendDone ? 1 : 0;
  if (LOCAL_LOGV)   Log.v(TAG,"String_Node_Str" + event + "String_Node_Str"+ mView);
  sendMessageAtTime(msg,event.getEventTime());
}
Program: 22064
Project: 22064
Buggy source:
private void deliverKeyEvent(KeyEvent event,boolean sendDone){
  boolean handled=mView != null ? mView.dispatchKeyEventPreIme(event) : true;
  if (handled) {
    if (sendDone) {
      if (LOCAL_LOGV)       Log.v(TAG,"String_Node_Str");
      finishKeyEvent(event);
    }
    return;
  }
  if (mLastWasImTarget) {
    InputMethodManager imm=InputMethodManager.peekInstance();
    if (imm != null && mView != null) {
      int seq=enqueuePendingEvent(event,sendDone);
      if (DEBUG_IMF)       Log.v(TAG,"String_Node_Str" + seq + "String_Node_Str"+ event);
      imm.dispatchKeyEvent(mView.getContext(),seq,event,mInputMethodCallback);
      return;
    }
  }
  deliverKeyEventToViewHierarchy(event,sendDone);
}

Fixed version (ground truth):
private void deliverKeyEvent(KeyEvent event,boolean sendDone){
  boolean handled=mView != null ? mView.dispatchKeyEventPreIme(event) : true;
  if (handled) {
    if (sendDone) {
      finishKeyEvent(event);
    }
    return;
  }
  if (mLastWasImTarget) {
    InputMethodManager imm=InputMethodManager.peekInstance();
    if (imm != null && mView != null) {
      int seq=enqueuePendingEvent(event,sendDone);
      if (DEBUG_IMF)       Log.v(TAG,"String_Node_Str" + seq + "String_Node_Str"+ event);
      imm.dispatchKeyEvent(mView.getContext(),seq,event,mInputMethodCallback);
      return;
    }
  }
  deliverKeyEventToViewHierarchy(event,sendDone);
}
Program: 22065
Project: 22065
Buggy source:
void handleFinishedEvent(int seq,boolean handled){
  final KeyEvent event=(KeyEvent)retrievePendingEvent(seq);
  if (DEBUG_IMF)   Log.v(TAG,"String_Node_Str" + seq + "String_Node_Str"+ handled+ "String_Node_Str"+ event);
  if (event != null) {
    final boolean sendDone=seq >= 0;
    if (!handled) {
      deliverKeyEventToViewHierarchy(event,sendDone);
      return;
    }
 else     if (sendDone) {
      if (LOCAL_LOGV)       Log.v(TAG,"String_Node_Str");
      finishKeyEvent(event);
    }
 else {
      Log.w(TAG,"String_Node_Str" + seq + "String_Node_Str"+ handled+ "String_Node_Str"+ event+ "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
void handleFinishedEvent(int seq,boolean handled){
  final KeyEvent event=(KeyEvent)retrievePendingEvent(seq);
  if (DEBUG_IMF)   Log.v(TAG,"String_Node_Str" + seq + "String_Node_Str"+ handled+ "String_Node_Str"+ event);
  if (event != null) {
    final boolean sendDone=seq >= 0;
    if (!handled) {
      deliverKeyEventToViewHierarchy(event,sendDone);
      return;
    }
 else     if (sendDone) {
      finishKeyEvent(event);
    }
 else {
      Log.w(TAG,"String_Node_Str" + seq + "String_Node_Str"+ handled+ "String_Node_Str"+ event+ "String_Node_Str");
    }
  }
}
Program: 22066
Project: 22066
Buggy source:
private void finishKeyEvent(KeyEvent event){
  if (mFinishedCallback != null) {
    mFinishedCallback.run();
    mFinishedCallback=null;
  }
}

Fixed version (ground truth):
private void finishKeyEvent(KeyEvent event){
  if (LOCAL_LOGV)   Log.v(TAG,"String_Node_Str");
  if (mFinishedCallback != null) {
    mFinishedCallback.run();
    mFinishedCallback=null;
  }
 else {
    Slog.w(TAG,"String_Node_Str" + "String_Node_Str");
  }
}
Program: 22067
Project: 22067
Buggy source:
public void handleKey(KeyEvent event,Runnable finishedCallback){
  mFinishedCallback=finishedCallback;
  dispatchKey(event);
}

Fixed version (ground truth):
public void handleKey(KeyEvent event,Runnable finishedCallback){
  if (mFinishedCallback != null) {
    Slog.w(TAG,"String_Node_Str" + "String_Node_Str");
  }
  mFinishedCallback=finishedCallback;
  dispatchKey(event,true);
}
Program: 22068
Project: 22068
Buggy source:
private void deliverKeyEventToViewHierarchy(KeyEvent event,boolean sendDone){
  try {
    if (mView != null && mAdded) {
      final int action=event.getAction();
      boolean isDown=(action == KeyEvent.ACTION_DOWN);
      if (checkForLeavingTouchModeAndConsume(event)) {
        return;
      }
      if (Config.LOGV) {
        captureKeyLog("String_Node_Str",event);
      }
      boolean keyHandled=mView.dispatchKeyEvent(event);
      if (!keyHandled && isDown) {
        int direction=0;
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_DPAD_LEFT:
          direction=View.FOCUS_LEFT;
        break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
      direction=View.FOCUS_RIGHT;
    break;
case KeyEvent.KEYCODE_DPAD_UP:
  direction=View.FOCUS_UP;
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
direction=View.FOCUS_DOWN;
break;
}
if (direction != 0) {
View focused=mView != null ? mView.findFocus() : null;
if (focused != null) {
View v=focused.focusSearch(direction);
boolean focusPassed=false;
if (v != null && v != focused) {
focused.getFocusedRect(mTempRect);
if (mView instanceof ViewGroup) {
((ViewGroup)mView).offsetDescendantRectToMyCoords(focused,mTempRect);
((ViewGroup)mView).offsetRectIntoDescendantCoords(v,mTempRect);
}
focusPassed=v.requestFocus(direction,mTempRect);
}
if (!focusPassed) {
mView.dispatchUnhandledMove(focused,direction);
}
 else {
playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));
}
}
}
}
}
}
  finally {
if (sendDone) {
if (LOCAL_LOGV) Log.v(TAG,"String_Node_Str");
finishKeyEvent(event);
}
}
}

Fixed version (ground truth):
private void deliverKeyEventToViewHierarchy(KeyEvent event,boolean sendDone){
  try {
    if (mView != null && mAdded) {
      final int action=event.getAction();
      boolean isDown=(action == KeyEvent.ACTION_DOWN);
      if (checkForLeavingTouchModeAndConsume(event)) {
        return;
      }
      if (Config.LOGV) {
        captureKeyLog("String_Node_Str",event);
      }
      boolean keyHandled=mView.dispatchKeyEvent(event);
      if (!keyHandled && isDown) {
        int direction=0;
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_DPAD_LEFT:
          direction=View.FOCUS_LEFT;
        break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
      direction=View.FOCUS_RIGHT;
    break;
case KeyEvent.KEYCODE_DPAD_UP:
  direction=View.FOCUS_UP;
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
direction=View.FOCUS_DOWN;
break;
}
if (direction != 0) {
View focused=mView != null ? mView.findFocus() : null;
if (focused != null) {
View v=focused.focusSearch(direction);
boolean focusPassed=false;
if (v != null && v != focused) {
focused.getFocusedRect(mTempRect);
if (mView instanceof ViewGroup) {
((ViewGroup)mView).offsetDescendantRectToMyCoords(focused,mTempRect);
((ViewGroup)mView).offsetRectIntoDescendantCoords(v,mTempRect);
}
focusPassed=v.requestFocus(direction,mTempRect);
}
if (!focusPassed) {
mView.dispatchUnhandledMove(focused,direction);
}
 else {
playSoundEffect(SoundEffectConstants.getContantForFocusDirection(direction));
}
}
}
}
}
}
  finally {
if (sendDone) {
finishKeyEvent(event);
}
}
}
Program: 22070
Project: 22070
Buggy source:
/** 
 * MotionEvent has no getRawX(int) method; simulate it pending future API approval. 
 */
private static float getRawX(MotionEvent event,int pointerIndex){
  float offset=event.getX() - event.getRawX();
  return event.getX(pointerIndex) + offset;
}

Fixed version (ground truth):
/** 
 * MotionEvent has no getRawX(int) method; simulate it pending future API approval. 
 */
private static float getRawX(MotionEvent event,int pointerIndex){
  float offset=event.getRawX() - event.getX();
  return event.getX(pointerIndex) + offset;
}
Program: 22071
Project: 22071
Buggy source:
/** 
 * MotionEvent has no getRawY(int) method; simulate it pending future API approval. 
 */
private static float getRawY(MotionEvent event,int pointerIndex){
  float offset=event.getY() - event.getRawY();
  return event.getY(pointerIndex) + offset;
}

Fixed version (ground truth):
/** 
 * MotionEvent has no getRawY(int) method; simulate it pending future API approval. 
 */
private static float getRawY(MotionEvent event,int pointerIndex){
  float offset=event.getRawY() - event.getY();
  return event.getY(pointerIndex) + offset;
}
Program: 22072
Project: 22072
Buggy source:
/** 
 * unregister phone from CallManager
 * @param phone
 */
public void unregisterPhone(Phone phone){
  if (phone != null && !mPhones.contains(phone)) {
    mPhones.remove(phone);
    mRingingCalls.remove(phone.getRingingCall());
    mBackgroundCalls.remove(phone.getBackgroundCall());
    mForegroundCalls.remove(phone.getForegroundCall());
    unregisterForPhoneStates(phone);
    if (phone == mDefaultPhone) {
      if (mPhones.isEmpty()) {
        mDefaultPhone=null;
      }
 else {
        mDefaultPhone=mPhones.get(0);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * unregister phone from CallManager
 * @param phone
 */
public void unregisterPhone(Phone phone){
  if (phone != null && mPhones.contains(phone)) {
    mPhones.remove(phone);
    mRingingCalls.remove(phone.getRingingCall());
    mBackgroundCalls.remove(phone.getBackgroundCall());
    mForegroundCalls.remove(phone.getForegroundCall());
    unregisterForPhoneStates(phone);
    if (phone == mDefaultPhone) {
      if (mPhones.isEmpty()) {
        mDefaultPhone=null;
      }
 else {
        mDefaultPhone=mPhones.get(0);
      }
    }
  }
}
Program: 22073
Project: 22073
Buggy source:
/** 
 * MotionEvent has no getRawX(int) method; simulate it pending future API approval. 
 */
private static float getRawX(MotionEvent event,int pointerIndex){
  float offset=event.getX() - event.getRawX();
  return event.getX(pointerIndex) + offset;
}

Fixed version (ground truth):
/** 
 * MotionEvent has no getRawX(int) method; simulate it pending future API approval. 
 */
private static float getRawX(MotionEvent event,int pointerIndex){
  float offset=event.getRawX() - event.getX();
  return event.getX(pointerIndex) + offset;
}
Program: 22074
Project: 22074
Buggy source:
/** 
 * MotionEvent has no getRawY(int) method; simulate it pending future API approval. 
 */
private static float getRawY(MotionEvent event,int pointerIndex){
  float offset=event.getY() - event.getRawY();
  return event.getY(pointerIndex) + offset;
}

Fixed version (ground truth):
/** 
 * MotionEvent has no getRawY(int) method; simulate it pending future API approval. 
 */
private static float getRawY(MotionEvent event,int pointerIndex){
  float offset=event.getRawY() - event.getY();
  return event.getY(pointerIndex) + offset;
}
Program: 22075
Project: 22075
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
  if (!Intent.ACTION_MEDIA_BUTTON.equals(action)) {
    return;
  }
  KeyEvent event=(KeyEvent)intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
  if (event != null) {
    if ((getMode() == AudioSystem.MODE_IN_CALL) || (getMode() == AudioSystem.MODE_RINGTONE)) {
      return;
    }
synchronized (mRCStack) {
      if (!mRCStack.empty()) {
        Intent targetedIntent=new Intent(Intent.ACTION_MEDIA_BUTTON);
        targetedIntent.putExtras(intent.getExtras());
        targetedIntent.setComponent(mRCStack.peek().mReceiverComponent);
        abortBroadcast();
        context.sendBroadcast(targetedIntent,null);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
  if (!Intent.ACTION_MEDIA_BUTTON.equals(action)) {
    return;
  }
  KeyEvent event=(KeyEvent)intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT);
  if (event != null) {
synchronized (mRingingLock) {
      if (mIsRinging || (getMode() == AudioSystem.MODE_IN_CALL) || (getMode() == AudioSystem.MODE_RINGTONE)) {
        return;
      }
    }
synchronized (mRCStack) {
      if (!mRCStack.empty()) {
        Intent targetedIntent=new Intent(Intent.ACTION_MEDIA_BUTTON);
        targetedIntent.putExtras(intent.getExtras());
        targetedIntent.setComponent(mRCStack.peek().mReceiverComponent);
        abortBroadcast();
        context.sendBroadcast(targetedIntent,null);
      }
    }
  }
}
Program: 22076
Project: 22076
Buggy source:
@Override public void onCallStateChanged(int state,String incomingNumber){
  if (state == TelephonyManager.CALL_STATE_RINGING) {
    int ringVolume=AudioService.this.getStreamVolume(AudioManager.STREAM_RING);
    if (ringVolume > 0) {
      requestAudioFocus(AudioManager.STREAM_RING,AudioManager.AUDIOFOCUS_GAIN_TRANSIENT,null,null,IN_VOICE_COMM_FOCUS_ID);
    }
  }
 else   if (state == TelephonyManager.CALL_STATE_OFFHOOK) {
    requestAudioFocus(AudioManager.STREAM_RING,AudioManager.AUDIOFOCUS_GAIN_TRANSIENT,null,null,IN_VOICE_COMM_FOCUS_ID);
  }
 else   if (state == TelephonyManager.CALL_STATE_IDLE) {
    abandonAudioFocus(null,IN_VOICE_COMM_FOCUS_ID);
  }
}

Fixed version (ground truth):
@Override public void onCallStateChanged(int state,String incomingNumber){
  if (state == TelephonyManager.CALL_STATE_RINGING) {
synchronized (mRingingLock) {
      mIsRinging=true;
    }
    int ringVolume=AudioService.this.getStreamVolume(AudioManager.STREAM_RING);
    if (ringVolume > 0) {
      requestAudioFocus(AudioManager.STREAM_RING,AudioManager.AUDIOFOCUS_GAIN_TRANSIENT,null,null,IN_VOICE_COMM_FOCUS_ID);
    }
  }
 else   if (state == TelephonyManager.CALL_STATE_OFFHOOK) {
synchronized (mRingingLock) {
      mIsRinging=false;
    }
    requestAudioFocus(AudioManager.STREAM_RING,AudioManager.AUDIOFOCUS_GAIN_TRANSIENT,null,null,IN_VOICE_COMM_FOCUS_ID);
  }
 else   if (state == TelephonyManager.CALL_STATE_IDLE) {
synchronized (mRingingLock) {
      mIsRinging=false;
    }
    abandonAudioFocus(null,IN_VOICE_COMM_FOCUS_ID);
  }
}