nus-yam/ex-repair huggingface dataset:
Program: 198185
Project: 198185
Buggy source:
/** 
 * Returns an intent to launch an activity that manages the given keyphrase for the locale.
 * @param action The enrollment related action that this intent is supposed to perform.This can be one of  {@link AlwaysOnHotwordDetector#MANAGE_ACTION_ENROLL},  {@link AlwaysOnHotwordDetector#MANAGE_ACTION_RE_ENROLL}or   {@link AlwaysOnHotwordDetector#MANAGE_ACTION_UN_ENROLL}
 * @param keyphrase The keyphrase that the user needs to be enrolled to.
 * @param locale The locale for which the enrollment needs to be performed.
 * @return An {@link Intent} to manage the keyphrase. This can be null if managing thegiven keyphrase/locale combination isn't possible.
 */
public Intent getManageKeyphraseIntent(int action,String keyphrase,Locale locale){
  if (mEnrollmentPackage == null || mEnrollmentPackage.isEmpty()) {
    Slog.w(TAG,"String_Node_Str");
    return null;
  }
  if (getKeyphraseMetadata(keyphrase,locale) != null) {
    Intent intent=new Intent(ACTION_MANAGE_VOICE_KEYPHRASES).setPackage(mEnrollmentPackage).putExtra(EXTRA_VOICE_KEYPHRASE_HINT_TEXT,keyphrase).putExtra(EXTRA_VOICE_KEYPHRASE_LOCALE,locale).putExtra(EXTRA_VOICE_KEYPHRASE_ACTION,action);
    return intent;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns an intent to launch an activity that manages the given keyphrase for the locale.
 * @param action The enrollment related action that this intent is supposed to perform.This can be one of  {@link AlwaysOnHotwordDetector#MANAGE_ACTION_ENROLL},  {@link AlwaysOnHotwordDetector#MANAGE_ACTION_RE_ENROLL}or   {@link AlwaysOnHotwordDetector#MANAGE_ACTION_UN_ENROLL}
 * @param keyphrase The keyphrase that the user needs to be enrolled to.
 * @param locale The locale for which the enrollment needs to be performed.
 * @return An {@link Intent} to manage the keyphrase. This can be null if managing thegiven keyphrase/locale combination isn't possible.
 */
public Intent getManageKeyphraseIntent(int action,String keyphrase,Locale locale){
  if (mEnrollmentPackage == null || mEnrollmentPackage.isEmpty()) {
    Slog.w(TAG,"String_Node_Str");
    return null;
  }
  if (getKeyphraseMetadata(keyphrase,locale) != null) {
    Intent intent=new Intent(ACTION_MANAGE_VOICE_KEYPHRASES).setPackage(mEnrollmentPackage).putExtra(EXTRA_VOICE_KEYPHRASE_HINT_TEXT,keyphrase).putExtra(EXTRA_VOICE_KEYPHRASE_LOCALE,locale.toLanguageTag()).putExtra(EXTRA_VOICE_KEYPHRASE_ACTION,action);
    return intent;
  }
  return null;
}
Program: 198186
Project: 198186
Buggy source:
/** 
 * Returns an intent to launch an activity that manages the given keyphrase for the locale.
 * @param action The enrollment related action that this intent is supposed to perform.This can be one of  {@link AlwaysOnHotwordDetector#MANAGE_ACTION_ENROLL},  {@link AlwaysOnHotwordDetector#MANAGE_ACTION_RE_ENROLL}or   {@link AlwaysOnHotwordDetector#MANAGE_ACTION_UN_ENROLL}
 * @param keyphrase The keyphrase that the user needs to be enrolled to.
 * @param locale The locale for which the enrollment needs to be performed.
 * @return An {@link Intent} to manage the keyphrase. This can be null if managing thegiven keyphrase/locale combination isn't possible.
 */
public Intent getManageKeyphraseIntent(int action,String keyphrase,Locale locale){
  if (mEnrollmentPackage == null || mEnrollmentPackage.isEmpty()) {
    Slog.w(TAG,"String_Node_Str");
    return null;
  }
  if (getKeyphraseMetadata(keyphrase,locale) != null) {
    Intent intent=new Intent(ACTION_MANAGE_VOICE_KEYPHRASES).setPackage(mEnrollmentPackage).putExtra(EXTRA_VOICE_KEYPHRASE_HINT_TEXT,keyphrase).putExtra(EXTRA_VOICE_KEYPHRASE_LOCALE,locale).putExtra(EXTRA_VOICE_KEYPHRASE_ACTION,action);
    return intent;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns an intent to launch an activity that manages the given keyphrase for the locale.
 * @param action The enrollment related action that this intent is supposed to perform.This can be one of  {@link AlwaysOnHotwordDetector#MANAGE_ACTION_ENROLL},  {@link AlwaysOnHotwordDetector#MANAGE_ACTION_RE_ENROLL}or   {@link AlwaysOnHotwordDetector#MANAGE_ACTION_UN_ENROLL}
 * @param keyphrase The keyphrase that the user needs to be enrolled to.
 * @param locale The locale for which the enrollment needs to be performed.
 * @return An {@link Intent} to manage the keyphrase. This can be null if managing thegiven keyphrase/locale combination isn't possible.
 */
public Intent getManageKeyphraseIntent(int action,String keyphrase,Locale locale){
  if (mEnrollmentPackage == null || mEnrollmentPackage.isEmpty()) {
    Slog.w(TAG,"String_Node_Str");
    return null;
  }
  if (getKeyphraseMetadata(keyphrase,locale) != null) {
    Intent intent=new Intent(ACTION_MANAGE_VOICE_KEYPHRASES).setPackage(mEnrollmentPackage).putExtra(EXTRA_VOICE_KEYPHRASE_HINT_TEXT,keyphrase).putExtra(EXTRA_VOICE_KEYPHRASE_LOCALE,locale.toLanguageTag()).putExtra(EXTRA_VOICE_KEYPHRASE_ACTION,action);
    return intent;
  }
  return null;
}
Program: 198187
Project: 198187
Buggy source:
/** 
 * Returns an intent to launch an activity that manages the given keyphrase for the locale.
 * @param action The enrollment related action that this intent is supposed to perform.This can be one of  {@link AlwaysOnHotwordDetector#MANAGE_ACTION_ENROLL},  {@link AlwaysOnHotwordDetector#MANAGE_ACTION_RE_ENROLL}or   {@link AlwaysOnHotwordDetector#MANAGE_ACTION_UN_ENROLL}
 * @param keyphrase The keyphrase that the user needs to be enrolled to.
 * @param locale The locale for which the enrollment needs to be performed.
 * @return An {@link Intent} to manage the keyphrase. This can be null if managing thegiven keyphrase/locale combination isn't possible.
 */
public Intent getManageKeyphraseIntent(int action,String keyphrase,Locale locale){
  if (mEnrollmentPackage == null || mEnrollmentPackage.isEmpty()) {
    Slog.w(TAG,"String_Node_Str");
    return null;
  }
  if (getKeyphraseMetadata(keyphrase,locale) != null) {
    Intent intent=new Intent(ACTION_MANAGE_VOICE_KEYPHRASES).setPackage(mEnrollmentPackage).putExtra(EXTRA_VOICE_KEYPHRASE_HINT_TEXT,keyphrase).putExtra(EXTRA_VOICE_KEYPHRASE_LOCALE,locale).putExtra(EXTRA_VOICE_KEYPHRASE_ACTION,action);
    return intent;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns an intent to launch an activity that manages the given keyphrase for the locale.
 * @param action The enrollment related action that this intent is supposed to perform.This can be one of  {@link AlwaysOnHotwordDetector#MANAGE_ACTION_ENROLL},  {@link AlwaysOnHotwordDetector#MANAGE_ACTION_RE_ENROLL}or   {@link AlwaysOnHotwordDetector#MANAGE_ACTION_UN_ENROLL}
 * @param keyphrase The keyphrase that the user needs to be enrolled to.
 * @param locale The locale for which the enrollment needs to be performed.
 * @return An {@link Intent} to manage the keyphrase. This can be null if managing thegiven keyphrase/locale combination isn't possible.
 */
public Intent getManageKeyphraseIntent(int action,String keyphrase,Locale locale){
  if (mEnrollmentPackage == null || mEnrollmentPackage.isEmpty()) {
    Slog.w(TAG,"String_Node_Str");
    return null;
  }
  if (getKeyphraseMetadata(keyphrase,locale) != null) {
    Intent intent=new Intent(ACTION_MANAGE_VOICE_KEYPHRASES).setPackage(mEnrollmentPackage).putExtra(EXTRA_VOICE_KEYPHRASE_HINT_TEXT,keyphrase).putExtra(EXTRA_VOICE_KEYPHRASE_LOCALE,locale.toLanguageTag()).putExtra(EXTRA_VOICE_KEYPHRASE_ACTION,action);
    return intent;
  }
  return null;
}
Program: 198188
Project: 198188
Buggy source:
@Override public void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  if (mActionBarView == null && MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST && mHeight >= 0) {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(Math.min(mHeight,MeasureSpec.getSize(heightMeasureSpec)),MeasureSpec.AT_MOST);
  }
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  if (mActionBarView == null)   return;
  int nonTabMaxHeight=0;
  final int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child == mTabContainer) {
      continue;
    }
    final LayoutParams lp=(LayoutParams)child.getLayoutParams();
    nonTabMaxHeight=isCollapsed(child) ? 0 : child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
  }
  if (mTabContainer != null && mTabContainer.getVisibility() != GONE) {
    final int mode=MeasureSpec.getMode(heightMeasureSpec);
    if (mode == MeasureSpec.AT_MOST) {
      final int maxHeight=MeasureSpec.getSize(heightMeasureSpec);
      setMeasuredDimension(getMeasuredWidth(),Math.min(nonTabMaxHeight + mTabContainer.getMeasuredHeight(),maxHeight));
    }
  }
}

Fixed version (ground truth):
@Override public void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  if (mActionBarView == null && MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST && mHeight >= 0) {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(Math.min(mHeight,MeasureSpec.getSize(heightMeasureSpec)),MeasureSpec.AT_MOST);
  }
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  if (mActionBarView == null)   return;
  int nonTabMaxHeight=0;
  final int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child == mTabContainer) {
      continue;
    }
    final LayoutParams lp=(LayoutParams)child.getLayoutParams();
    nonTabMaxHeight=Math.max(nonTabMaxHeight,isCollapsed(child) ? 0 : child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin);
  }
  if (mTabContainer != null && mTabContainer.getVisibility() != GONE) {
    final int mode=MeasureSpec.getMode(heightMeasureSpec);
    if (mode == MeasureSpec.AT_MOST) {
      final int maxHeight=MeasureSpec.getSize(heightMeasureSpec);
      setMeasuredDimension(getMeasuredWidth(),Math.min(nonTabMaxHeight + mTabContainer.getMeasuredHeight(),maxHeight));
    }
  }
}
Program: 198189
Project: 198189
Buggy source:
@Override public void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  if (mActionBarView == null && MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST && mHeight >= 0) {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(Math.min(mHeight,MeasureSpec.getSize(heightMeasureSpec)),MeasureSpec.AT_MOST);
  }
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  if (mActionBarView == null)   return;
  int nonTabMaxHeight=0;
  final int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child == mTabContainer) {
      continue;
    }
    final LayoutParams lp=(LayoutParams)child.getLayoutParams();
    nonTabMaxHeight=isCollapsed(child) ? 0 : child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
  }
  if (mTabContainer != null && mTabContainer.getVisibility() != GONE) {
    final int mode=MeasureSpec.getMode(heightMeasureSpec);
    if (mode == MeasureSpec.AT_MOST) {
      final int maxHeight=MeasureSpec.getSize(heightMeasureSpec);
      setMeasuredDimension(getMeasuredWidth(),Math.min(nonTabMaxHeight + mTabContainer.getMeasuredHeight(),maxHeight));
    }
  }
}

Fixed version (ground truth):
@Override public void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  if (mActionBarView == null && MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST && mHeight >= 0) {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(Math.min(mHeight,MeasureSpec.getSize(heightMeasureSpec)),MeasureSpec.AT_MOST);
  }
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  if (mActionBarView == null)   return;
  int nonTabMaxHeight=0;
  final int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child == mTabContainer) {
      continue;
    }
    final LayoutParams lp=(LayoutParams)child.getLayoutParams();
    nonTabMaxHeight=Math.max(nonTabMaxHeight,isCollapsed(child) ? 0 : child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin);
  }
  if (mTabContainer != null && mTabContainer.getVisibility() != GONE) {
    final int mode=MeasureSpec.getMode(heightMeasureSpec);
    if (mode == MeasureSpec.AT_MOST) {
      final int maxHeight=MeasureSpec.getSize(heightMeasureSpec);
      setMeasuredDimension(getMeasuredWidth(),Math.min(nonTabMaxHeight + mTabContainer.getMeasuredHeight(),maxHeight));
    }
  }
}
Program: 198190
Project: 198190
Buggy source:
@Override public void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  if (mActionBarView == null && MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST && mHeight >= 0) {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(Math.min(mHeight,MeasureSpec.getSize(heightMeasureSpec)),MeasureSpec.AT_MOST);
  }
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  if (mActionBarView == null)   return;
  int nonTabMaxHeight=0;
  final int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child == mTabContainer) {
      continue;
    }
    final LayoutParams lp=(LayoutParams)child.getLayoutParams();
    nonTabMaxHeight=isCollapsed(child) ? 0 : child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
  }
  if (mTabContainer != null && mTabContainer.getVisibility() != GONE) {
    final int mode=MeasureSpec.getMode(heightMeasureSpec);
    if (mode == MeasureSpec.AT_MOST) {
      final int maxHeight=MeasureSpec.getSize(heightMeasureSpec);
      setMeasuredDimension(getMeasuredWidth(),Math.min(nonTabMaxHeight + mTabContainer.getMeasuredHeight(),maxHeight));
    }
  }
}

Fixed version (ground truth):
@Override public void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  if (mActionBarView == null && MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST && mHeight >= 0) {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(Math.min(mHeight,MeasureSpec.getSize(heightMeasureSpec)),MeasureSpec.AT_MOST);
  }
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  if (mActionBarView == null)   return;
  int nonTabMaxHeight=0;
  final int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child == mTabContainer) {
      continue;
    }
    final LayoutParams lp=(LayoutParams)child.getLayoutParams();
    nonTabMaxHeight=Math.max(nonTabMaxHeight,isCollapsed(child) ? 0 : child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin);
  }
  if (mTabContainer != null && mTabContainer.getVisibility() != GONE) {
    final int mode=MeasureSpec.getMode(heightMeasureSpec);
    if (mode == MeasureSpec.AT_MOST) {
      final int maxHeight=MeasureSpec.getSize(heightMeasureSpec);
      setMeasuredDimension(getMeasuredWidth(),Math.min(nonTabMaxHeight + mTabContainer.getMeasuredHeight(),maxHeight));
    }
  }
}
Program: 198191
Project: 198191
Buggy source:
@Override public void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  if (mActionBarView == null && MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST && mHeight >= 0) {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(Math.min(mHeight,MeasureSpec.getSize(heightMeasureSpec)),MeasureSpec.AT_MOST);
  }
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  if (mActionBarView == null)   return;
  int nonTabMaxHeight=0;
  final int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child == mTabContainer) {
      continue;
    }
    final LayoutParams lp=(LayoutParams)child.getLayoutParams();
    nonTabMaxHeight=isCollapsed(child) ? 0 : child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
  }
  if (mTabContainer != null && mTabContainer.getVisibility() != GONE) {
    final int mode=MeasureSpec.getMode(heightMeasureSpec);
    if (mode == MeasureSpec.AT_MOST) {
      final int maxHeight=MeasureSpec.getSize(heightMeasureSpec);
      setMeasuredDimension(getMeasuredWidth(),Math.min(nonTabMaxHeight + mTabContainer.getMeasuredHeight(),maxHeight));
    }
  }
}

Fixed version (ground truth):
@Override public void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  if (mActionBarView == null && MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST && mHeight >= 0) {
    heightMeasureSpec=MeasureSpec.makeMeasureSpec(Math.min(mHeight,MeasureSpec.getSize(heightMeasureSpec)),MeasureSpec.AT_MOST);
  }
  super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  if (mActionBarView == null)   return;
  int nonTabMaxHeight=0;
  final int childCount=getChildCount();
  for (int i=0; i < childCount; i++) {
    final View child=getChildAt(i);
    if (child == mTabContainer) {
      continue;
    }
    final LayoutParams lp=(LayoutParams)child.getLayoutParams();
    nonTabMaxHeight=Math.max(nonTabMaxHeight,isCollapsed(child) ? 0 : child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin);
  }
  if (mTabContainer != null && mTabContainer.getVisibility() != GONE) {
    final int mode=MeasureSpec.getMode(heightMeasureSpec);
    if (mode == MeasureSpec.AT_MOST) {
      final int maxHeight=MeasureSpec.getSize(heightMeasureSpec);
      setMeasuredDimension(getMeasuredWidth(),Math.min(nonTabMaxHeight + mTabContainer.getMeasuredHeight(),maxHeight));
    }
  }
}
Program: 198192
Project: 198192
Buggy source:
@Override public boolean onLongClick(View v){
  if (hasText()) {
    return false;
  }
  final int[] screenPos=new int[2];
  final Rect displayFrame=new Rect();
  getLocationOnScreen(screenPos);
  getWindowVisibleDisplayFrame(displayFrame);
  final Context context=getContext();
  final int width=getWidth();
  final int height=getHeight();
  final int midy=screenPos[1] + height / 2;
  final int screenWidth=context.getResources().getDisplayMetrics().widthPixels;
  Toast cheatSheet=Toast.makeText(context,mItemData.getTitle(),Toast.LENGTH_SHORT);
  if (midy < displayFrame.height()) {
    cheatSheet.setGravity(Gravity.TOP | Gravity.END,screenWidth - screenPos[0] - width / 2,height);
  }
 else {
    cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL,0,height);
  }
  cheatSheet.show();
  return true;
}

Fixed version (ground truth):
@Override public boolean onLongClick(View v){
  if (hasText()) {
    return false;
  }
  final int[] screenPos=new int[2];
  final Rect displayFrame=new Rect();
  getLocationOnScreen(screenPos);
  getWindowVisibleDisplayFrame(displayFrame);
  final Context context=getContext();
  final int width=getWidth();
  final int height=getHeight();
  final int midy=screenPos[1] + height / 2;
  int referenceX=screenPos[0] + width / 2;
  if (v.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR) {
    final int screenWidth=context.getResources().getDisplayMetrics().widthPixels;
    referenceX=screenWidth - referenceX;
  }
  Toast cheatSheet=Toast.makeText(context,mItemData.getTitle(),Toast.LENGTH_SHORT);
  if (midy < displayFrame.height()) {
    cheatSheet.setGravity(Gravity.TOP | Gravity.END,referenceX,height);
  }
 else {
    cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL,0,height);
  }
  cheatSheet.show();
  return true;
}
Program: 198193
Project: 198193
Buggy source:
@Override public boolean onLongClick(View v){
  if (hasText()) {
    return false;
  }
  final int[] screenPos=new int[2];
  final Rect displayFrame=new Rect();
  getLocationOnScreen(screenPos);
  getWindowVisibleDisplayFrame(displayFrame);
  final Context context=getContext();
  final int width=getWidth();
  final int height=getHeight();
  final int midy=screenPos[1] + height / 2;
  final int screenWidth=context.getResources().getDisplayMetrics().widthPixels;
  Toast cheatSheet=Toast.makeText(context,mItemData.getTitle(),Toast.LENGTH_SHORT);
  if (midy < displayFrame.height()) {
    cheatSheet.setGravity(Gravity.TOP | Gravity.END,screenWidth - screenPos[0] - width / 2,height);
  }
 else {
    cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL,0,height);
  }
  cheatSheet.show();
  return true;
}

Fixed version (ground truth):
@Override public boolean onLongClick(View v){
  if (hasText()) {
    return false;
  }
  final int[] screenPos=new int[2];
  final Rect displayFrame=new Rect();
  getLocationOnScreen(screenPos);
  getWindowVisibleDisplayFrame(displayFrame);
  final Context context=getContext();
  final int width=getWidth();
  final int height=getHeight();
  final int midy=screenPos[1] + height / 2;
  int referenceX=screenPos[0] + width / 2;
  if (v.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR) {
    final int screenWidth=context.getResources().getDisplayMetrics().widthPixels;
    referenceX=screenWidth - referenceX;
  }
  Toast cheatSheet=Toast.makeText(context,mItemData.getTitle(),Toast.LENGTH_SHORT);
  if (midy < displayFrame.height()) {
    cheatSheet.setGravity(Gravity.TOP | Gravity.END,referenceX,height);
  }
 else {
    cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL,0,height);
  }
  cheatSheet.show();
  return true;
}
Program: 198194
Project: 198194
Buggy source:
@Override public boolean onLongClick(View v){
  if (hasText()) {
    return false;
  }
  final int[] screenPos=new int[2];
  final Rect displayFrame=new Rect();
  getLocationOnScreen(screenPos);
  getWindowVisibleDisplayFrame(displayFrame);
  final Context context=getContext();
  final int width=getWidth();
  final int height=getHeight();
  final int midy=screenPos[1] + height / 2;
  final int screenWidth=context.getResources().getDisplayMetrics().widthPixels;
  Toast cheatSheet=Toast.makeText(context,mItemData.getTitle(),Toast.LENGTH_SHORT);
  if (midy < displayFrame.height()) {
    cheatSheet.setGravity(Gravity.TOP | Gravity.END,screenWidth - screenPos[0] - width / 2,height);
  }
 else {
    cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL,0,height);
  }
  cheatSheet.show();
  return true;
}

Fixed version (ground truth):
@Override public boolean onLongClick(View v){
  if (hasText()) {
    return false;
  }
  final int[] screenPos=new int[2];
  final Rect displayFrame=new Rect();
  getLocationOnScreen(screenPos);
  getWindowVisibleDisplayFrame(displayFrame);
  final Context context=getContext();
  final int width=getWidth();
  final int height=getHeight();
  final int midy=screenPos[1] + height / 2;
  int referenceX=screenPos[0] + width / 2;
  if (v.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR) {
    final int screenWidth=context.getResources().getDisplayMetrics().widthPixels;
    referenceX=screenWidth - referenceX;
  }
  Toast cheatSheet=Toast.makeText(context,mItemData.getTitle(),Toast.LENGTH_SHORT);
  if (midy < displayFrame.height()) {
    cheatSheet.setGravity(Gravity.TOP | Gravity.END,referenceX,height);
  }
 else {
    cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL,0,height);
  }
  cheatSheet.show();
  return true;
}
Program: 198195
Project: 198195
Buggy source:
@Override public boolean onLongClick(View v){
  if (hasText()) {
    return false;
  }
  final int[] screenPos=new int[2];
  final Rect displayFrame=new Rect();
  getLocationOnScreen(screenPos);
  getWindowVisibleDisplayFrame(displayFrame);
  final Context context=getContext();
  final int width=getWidth();
  final int height=getHeight();
  final int midy=screenPos[1] + height / 2;
  final int screenWidth=context.getResources().getDisplayMetrics().widthPixels;
  Toast cheatSheet=Toast.makeText(context,mItemData.getTitle(),Toast.LENGTH_SHORT);
  if (midy < displayFrame.height()) {
    cheatSheet.setGravity(Gravity.TOP | Gravity.END,screenWidth - screenPos[0] - width / 2,height);
  }
 else {
    cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL,0,height);
  }
  cheatSheet.show();
  return true;
}

Fixed version (ground truth):
@Override public boolean onLongClick(View v){
  if (hasText()) {
    return false;
  }
  final int[] screenPos=new int[2];
  final Rect displayFrame=new Rect();
  getLocationOnScreen(screenPos);
  getWindowVisibleDisplayFrame(displayFrame);
  final Context context=getContext();
  final int width=getWidth();
  final int height=getHeight();
  final int midy=screenPos[1] + height / 2;
  int referenceX=screenPos[0] + width / 2;
  if (v.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR) {
    final int screenWidth=context.getResources().getDisplayMetrics().widthPixels;
    referenceX=screenWidth - referenceX;
  }
  Toast cheatSheet=Toast.makeText(context,mItemData.getTitle(),Toast.LENGTH_SHORT);
  if (midy < displayFrame.height()) {
    cheatSheet.setGravity(Gravity.TOP | Gravity.END,referenceX,height);
  }
 else {
    cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL,0,height);
  }
  cheatSheet.show();
  return true;
}
Program: 198196
Project: 198196
Buggy source:
@Override public boolean onLongClick(View v){
  if (hasText()) {
    return false;
  }
  final int[] screenPos=new int[2];
  final Rect displayFrame=new Rect();
  getLocationOnScreen(screenPos);
  getWindowVisibleDisplayFrame(displayFrame);
  final Context context=getContext();
  final int width=getWidth();
  final int height=getHeight();
  final int midy=screenPos[1] + height / 2;
  final int screenWidth=context.getResources().getDisplayMetrics().widthPixels;
  Toast cheatSheet=Toast.makeText(context,mItemData.getTitle(),Toast.LENGTH_SHORT);
  if (midy < displayFrame.height()) {
    cheatSheet.setGravity(Gravity.TOP | Gravity.END,screenWidth - screenPos[0] - width / 2,height);
  }
 else {
    cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL,0,height);
  }
  cheatSheet.show();
  return true;
}

Fixed version (ground truth):
@Override public boolean onLongClick(View v){
  if (hasText()) {
    return false;
  }
  final int[] screenPos=new int[2];
  final Rect displayFrame=new Rect();
  getLocationOnScreen(screenPos);
  getWindowVisibleDisplayFrame(displayFrame);
  final Context context=getContext();
  final int width=getWidth();
  final int height=getHeight();
  final int midy=screenPos[1] + height / 2;
  int referenceX=screenPos[0] + width / 2;
  if (v.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR) {
    final int screenWidth=context.getResources().getDisplayMetrics().widthPixels;
    referenceX=screenWidth - referenceX;
  }
  Toast cheatSheet=Toast.makeText(context,mItemData.getTitle(),Toast.LENGTH_SHORT);
  if (midy < displayFrame.height()) {
    cheatSheet.setGravity(Gravity.TOP | Gravity.END,referenceX,height);
  }
 else {
    cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL,0,height);
  }
  cheatSheet.show();
  return true;
}
Program: 198197
Project: 198197
Buggy source:
private static String createImageFilename(ActivityRecord r,int taskId){
  return String.valueOf(taskId) + ACTIVITY_ICON_SUFFIX + r.createTime+ TaskPersister.IMAGE_EXTENSION;
}

Fixed version (ground truth):
private static String createImageFilename(long createTime,int taskId){
  return String.valueOf(taskId) + ACTIVITY_ICON_SUFFIX + createTime+ TaskPersister.IMAGE_EXTENSION;
}
Program: 198198
Project: 198198
Buggy source:
void saveToXml(XmlSerializer out) throws IOException, XmlPullParserException {
  out.attribute(null,ATTR_ID,String.valueOf(createTime));
  out.attribute(null,ATTR_LAUNCHEDFROMUID,String.valueOf(launchedFromUid));
  if (launchedFromPackage != null) {
    out.attribute(null,ATTR_LAUNCHEDFROMPACKAGE,launchedFromPackage);
  }
  if (resolvedType != null) {
    out.attribute(null,ATTR_RESOLVEDTYPE,resolvedType);
  }
  out.attribute(null,ATTR_COMPONENTSPECIFIED,String.valueOf(componentSpecified));
  out.attribute(null,ATTR_USERID,String.valueOf(userId));
  if (taskDescription != null) {
    task.saveTaskDescription(taskDescription,createImageFilename(this,task.taskId),out);
  }
  out.startTag(null,TAG_INTENT);
  intent.saveToXml(out);
  out.endTag(null,TAG_INTENT);
  if (isPersistable() && persistentState != null) {
    out.startTag(null,TAG_PERSISTABLEBUNDLE);
    persistentState.saveToXml(out);
    out.endTag(null,TAG_PERSISTABLEBUNDLE);
  }
}

Fixed version (ground truth):
void saveToXml(XmlSerializer out) throws IOException, XmlPullParserException {
  out.attribute(null,ATTR_ID,String.valueOf(createTime));
  out.attribute(null,ATTR_LAUNCHEDFROMUID,String.valueOf(launchedFromUid));
  if (launchedFromPackage != null) {
    out.attribute(null,ATTR_LAUNCHEDFROMPACKAGE,launchedFromPackage);
  }
  if (resolvedType != null) {
    out.attribute(null,ATTR_RESOLVEDTYPE,resolvedType);
  }
  out.attribute(null,ATTR_COMPONENTSPECIFIED,String.valueOf(componentSpecified));
  out.attribute(null,ATTR_USERID,String.valueOf(userId));
  if (taskDescription != null) {
    task.saveTaskDescription(taskDescription,createImageFilename(createTime,task.taskId),out);
  }
  out.startTag(null,TAG_INTENT);
  intent.saveToXml(out);
  out.endTag(null,TAG_INTENT);
  if (isPersistable() && persistentState != null) {
    out.startTag(null,TAG_PERSISTABLEBUNDLE);
    persistentState.saveToXml(out);
    out.endTag(null,TAG_PERSISTABLEBUNDLE);
  }
}
Program: 198202
Project: 198202
Buggy source:
private static String createImageFilename(ActivityRecord r,int taskId){
  return String.valueOf(taskId) + ACTIVITY_ICON_SUFFIX + r.createTime+ TaskPersister.IMAGE_EXTENSION;
}

Fixed version (ground truth):
private static String createImageFilename(long createTime,int taskId){
  return String.valueOf(taskId) + ACTIVITY_ICON_SUFFIX + createTime+ TaskPersister.IMAGE_EXTENSION;
}
Program: 198203
Project: 198203
Buggy source:
void saveToXml(XmlSerializer out) throws IOException, XmlPullParserException {
  out.attribute(null,ATTR_ID,String.valueOf(createTime));
  out.attribute(null,ATTR_LAUNCHEDFROMUID,String.valueOf(launchedFromUid));
  if (launchedFromPackage != null) {
    out.attribute(null,ATTR_LAUNCHEDFROMPACKAGE,launchedFromPackage);
  }
  if (resolvedType != null) {
    out.attribute(null,ATTR_RESOLVEDTYPE,resolvedType);
  }
  out.attribute(null,ATTR_COMPONENTSPECIFIED,String.valueOf(componentSpecified));
  out.attribute(null,ATTR_USERID,String.valueOf(userId));
  if (taskDescription != null) {
    task.saveTaskDescription(taskDescription,createImageFilename(this,task.taskId),out);
  }
  out.startTag(null,TAG_INTENT);
  intent.saveToXml(out);
  out.endTag(null,TAG_INTENT);
  if (isPersistable() && persistentState != null) {
    out.startTag(null,TAG_PERSISTABLEBUNDLE);
    persistentState.saveToXml(out);
    out.endTag(null,TAG_PERSISTABLEBUNDLE);
  }
}

Fixed version (ground truth):
void saveToXml(XmlSerializer out) throws IOException, XmlPullParserException {
  out.attribute(null,ATTR_ID,String.valueOf(createTime));
  out.attribute(null,ATTR_LAUNCHEDFROMUID,String.valueOf(launchedFromUid));
  if (launchedFromPackage != null) {
    out.attribute(null,ATTR_LAUNCHEDFROMPACKAGE,launchedFromPackage);
  }
  if (resolvedType != null) {
    out.attribute(null,ATTR_RESOLVEDTYPE,resolvedType);
  }
  out.attribute(null,ATTR_COMPONENTSPECIFIED,String.valueOf(componentSpecified));
  out.attribute(null,ATTR_USERID,String.valueOf(userId));
  if (taskDescription != null) {
    task.saveTaskDescription(taskDescription,createImageFilename(createTime,task.taskId),out);
  }
  out.startTag(null,TAG_INTENT);
  intent.saveToXml(out);
  out.endTag(null,TAG_INTENT);
  if (isPersistable() && persistentState != null) {
    out.startTag(null,TAG_PERSISTABLEBUNDLE);
    persistentState.saveToXml(out);
    out.endTag(null,TAG_PERSISTABLEBUNDLE);
  }
}
Program: 198207
Project: 198207
Buggy source:
private static String createImageFilename(ActivityRecord r,int taskId){
  return String.valueOf(taskId) + ACTIVITY_ICON_SUFFIX + r.createTime+ TaskPersister.IMAGE_EXTENSION;
}

Fixed version (ground truth):
private static String createImageFilename(long createTime,int taskId){
  return String.valueOf(taskId) + ACTIVITY_ICON_SUFFIX + createTime+ TaskPersister.IMAGE_EXTENSION;
}
Program: 198208
Project: 198208
Buggy source:
void saveToXml(XmlSerializer out) throws IOException, XmlPullParserException {
  out.attribute(null,ATTR_ID,String.valueOf(createTime));
  out.attribute(null,ATTR_LAUNCHEDFROMUID,String.valueOf(launchedFromUid));
  if (launchedFromPackage != null) {
    out.attribute(null,ATTR_LAUNCHEDFROMPACKAGE,launchedFromPackage);
  }
  if (resolvedType != null) {
    out.attribute(null,ATTR_RESOLVEDTYPE,resolvedType);
  }
  out.attribute(null,ATTR_COMPONENTSPECIFIED,String.valueOf(componentSpecified));
  out.attribute(null,ATTR_USERID,String.valueOf(userId));
  if (taskDescription != null) {
    task.saveTaskDescription(taskDescription,createImageFilename(this,task.taskId),out);
  }
  out.startTag(null,TAG_INTENT);
  intent.saveToXml(out);
  out.endTag(null,TAG_INTENT);
  if (isPersistable() && persistentState != null) {
    out.startTag(null,TAG_PERSISTABLEBUNDLE);
    persistentState.saveToXml(out);
    out.endTag(null,TAG_PERSISTABLEBUNDLE);
  }
}

Fixed version (ground truth):
void saveToXml(XmlSerializer out) throws IOException, XmlPullParserException {
  out.attribute(null,ATTR_ID,String.valueOf(createTime));
  out.attribute(null,ATTR_LAUNCHEDFROMUID,String.valueOf(launchedFromUid));
  if (launchedFromPackage != null) {
    out.attribute(null,ATTR_LAUNCHEDFROMPACKAGE,launchedFromPackage);
  }
  if (resolvedType != null) {
    out.attribute(null,ATTR_RESOLVEDTYPE,resolvedType);
  }
  out.attribute(null,ATTR_COMPONENTSPECIFIED,String.valueOf(componentSpecified));
  out.attribute(null,ATTR_USERID,String.valueOf(userId));
  if (taskDescription != null) {
    task.saveTaskDescription(taskDescription,createImageFilename(createTime,task.taskId),out);
  }
  out.startTag(null,TAG_INTENT);
  intent.saveToXml(out);
  out.endTag(null,TAG_INTENT);
  if (isPersistable() && persistentState != null) {
    out.startTag(null,TAG_PERSISTABLEBUNDLE);
    persistentState.saveToXml(out);
    out.endTag(null,TAG_PERSISTABLEBUNDLE);
  }
}
Program: 198212
Project: 198212
Buggy source:
private static String createImageFilename(ActivityRecord r,int taskId){
  return String.valueOf(taskId) + ACTIVITY_ICON_SUFFIX + r.createTime+ TaskPersister.IMAGE_EXTENSION;
}

Fixed version (ground truth):
private static String createImageFilename(long createTime,int taskId){
  return String.valueOf(taskId) + ACTIVITY_ICON_SUFFIX + createTime+ TaskPersister.IMAGE_EXTENSION;
}
Program: 198213
Project: 198213
Buggy source:
void saveToXml(XmlSerializer out) throws IOException, XmlPullParserException {
  out.attribute(null,ATTR_ID,String.valueOf(createTime));
  out.attribute(null,ATTR_LAUNCHEDFROMUID,String.valueOf(launchedFromUid));
  if (launchedFromPackage != null) {
    out.attribute(null,ATTR_LAUNCHEDFROMPACKAGE,launchedFromPackage);
  }
  if (resolvedType != null) {
    out.attribute(null,ATTR_RESOLVEDTYPE,resolvedType);
  }
  out.attribute(null,ATTR_COMPONENTSPECIFIED,String.valueOf(componentSpecified));
  out.attribute(null,ATTR_USERID,String.valueOf(userId));
  if (taskDescription != null) {
    task.saveTaskDescription(taskDescription,createImageFilename(this,task.taskId),out);
  }
  out.startTag(null,TAG_INTENT);
  intent.saveToXml(out);
  out.endTag(null,TAG_INTENT);
  if (isPersistable() && persistentState != null) {
    out.startTag(null,TAG_PERSISTABLEBUNDLE);
    persistentState.saveToXml(out);
    out.endTag(null,TAG_PERSISTABLEBUNDLE);
  }
}

Fixed version (ground truth):
void saveToXml(XmlSerializer out) throws IOException, XmlPullParserException {
  out.attribute(null,ATTR_ID,String.valueOf(createTime));
  out.attribute(null,ATTR_LAUNCHEDFROMUID,String.valueOf(launchedFromUid));
  if (launchedFromPackage != null) {
    out.attribute(null,ATTR_LAUNCHEDFROMPACKAGE,launchedFromPackage);
  }
  if (resolvedType != null) {
    out.attribute(null,ATTR_RESOLVEDTYPE,resolvedType);
  }
  out.attribute(null,ATTR_COMPONENTSPECIFIED,String.valueOf(componentSpecified));
  out.attribute(null,ATTR_USERID,String.valueOf(userId));
  if (taskDescription != null) {
    task.saveTaskDescription(taskDescription,createImageFilename(createTime,task.taskId),out);
  }
  out.startTag(null,TAG_INTENT);
  intent.saveToXml(out);
  out.endTag(null,TAG_INTENT);
  if (isPersistable() && persistentState != null) {
    out.startTag(null,TAG_PERSISTABLEBUNDLE);
    persistentState.saveToXml(out);
    out.endTag(null,TAG_PERSISTABLEBUNDLE);
  }
}
Program: 198217
Project: 198217
Buggy source:
@Override public void run(){
  callback.onStartFailure(error);
}

Fixed version (ground truth):
@Override public void run(){
  callback.onStartSuccess(settings);
}
Program: 198219
Project: 198219
Buggy source:
/** 
 * Stop Bluetooth LE advertising. The   {@code callback} must be the same one use in{@link BluetoothLeAdvertiser#startAdvertising}. <p> Requires   {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission.
 * @param callback {@link AdvertiseCallback} identifies the advertising instance to stop.
 */
public void stopAdvertising(final AdvertiseCallback callback){
  checkAdapterState();
  if (callback == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  AdvertiseCallbackWrapper wrapper=mLeAdvertisers.get(callback);
  if (wrapper == null)   return;
  try {
    IBluetoothGatt gatt=mBluetoothManager.getBluetoothGatt();
    if (gatt != null)     gatt.stopMultiAdvertising(wrapper.mClientIf);
    if (wrapper.advertiseStopped()) {
      mLeAdvertisers.remove(callback);
    }
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void stopAdvertising(){
synchronized (this) {
    try {
      mBluetoothGatt.stopMultiAdvertising(mClientIf);
      wait(LE_CALLBACK_TIMEOUT_MILLIS);
    }
 catch (    InterruptedException|RemoteException e) {
      Log.e(TAG,"String_Node_Str",e);
    }
    if (mLeAdvertisers.containsKey(mAdvertiseCallback)) {
      mLeAdvertisers.remove(mAdvertiseCallback);
    }
  }
}
Program: 198220
Project: 198220
Buggy source:
/** 
 * Application interface registered - app is ready to go
 */
@Override public void onClientRegistered(int status,int clientIf){
  Log.d(TAG,"String_Node_Str" + status + "String_Node_Str"+ clientIf);
synchronized (this) {
    if (status == BluetoothGatt.GATT_SUCCESS) {
      mClientIf=clientIf;
      try {
        mBluetoothGatt.startMultiAdvertising(mClientIf,mAdvertisement,mScanResponse,mSettings);
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str" + e);
        mClientIf=-1;
        notifyAll();
      }
    }
 else {
      mClientIf=-1;
      notifyAll();
    }
  }
}

Fixed version (ground truth):
/** 
 * Application interface registered - app is ready to go
 */
@Override public void onClientRegistered(int status,int clientIf){
  Log.d(TAG,"String_Node_Str" + status + "String_Node_Str"+ clientIf);
synchronized (this) {
    if (status == BluetoothGatt.GATT_SUCCESS) {
      mClientIf=clientIf;
      try {
        mBluetoothGatt.startMultiAdvertising(mClientIf,mAdvertisement,mScanResponse,mSettings);
        return;
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
    mClientIf=-1;
    notifyAll();
  }
}
Program: 198221
Project: 198221
Buggy source:
@Override public void onMultiAdvertiseCallback(int status,boolean isStart,AdvertiseSettings settings){
synchronized (this) {
    if (isStart) {
      if (status == AdvertiseCallback.ADVERTISE_SUCCESS) {
        mAdvertiseCallback.onStartSuccess(settings);
        mIsAdvertising=true;
      }
 else {
        mAdvertiseCallback.onStartFailure(status);
      }
    }
 else {
      try {
        mBluetoothGatt.unregisterClient(mClientIf);
        mClientIf=-1;
        mIsAdvertising=false;
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
    notifyAll();
  }
}

Fixed version (ground truth):
@Override public void onMultiAdvertiseCallback(int status,boolean isStart,AdvertiseSettings settings){
synchronized (this) {
    if (isStart) {
      if (status == AdvertiseCallback.ADVERTISE_SUCCESS) {
        mIsAdvertising=true;
        postStartSuccess(mAdvertiseCallback,settings);
      }
 else {
        postStartFailure(mAdvertiseCallback,status);
      }
    }
 else {
      try {
        mBluetoothGatt.unregisterClient(mClientIf);
        mClientIf=-1;
        mIsAdvertising=false;
        mLeAdvertisers.remove(mAdvertiseCallback);
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
    notifyAll();
  }
}
Program: 198222
Project: 198222
Buggy source:
private int totalBytes(AdvertiseData data){
  if (data == null) {
    return 0;
  }
  int size=FLAGS_FIELD_BYTES;
  if (data.getServiceUuids() != null) {
    int num16BitUuids=0;
    int num32BitUuids=0;
    int num128BitUuids=0;
    for (    ParcelUuid uuid : data.getServiceUuids()) {
      if (BluetoothUuid.is16BitUuid(uuid)) {
        ++num16BitUuids;
      }
 else       if (BluetoothUuid.is32BitUuid(uuid)) {
        ++num32BitUuids;
      }
 else {
        ++num128BitUuids;
      }
    }
    if (num16BitUuids != 0) {
      size+=OVERHEAD_BYTES_PER_FIELD + num16BitUuids * BluetoothUuid.UUID_BYTES_16_BIT;
    }
    if (num32BitUuids != 0) {
      size+=OVERHEAD_BYTES_PER_FIELD + num32BitUuids * BluetoothUuid.UUID_BYTES_32_BIT;
    }
    if (num128BitUuids != 0) {
      size+=OVERHEAD_BYTES_PER_FIELD + num128BitUuids * BluetoothUuid.UUID_BYTES_128_BIT;
    }
  }
  for (  ParcelUuid uuid : data.getServiceData().keySet()) {
    size+=OVERHEAD_BYTES_PER_FIELD + SERVICE_DATA_UUID_LENGTH + byteLength(data.getServiceData().get(uuid));
  }
  for (int i=0; i < data.getManufacturerSpecificData().size(); ++i) {
    size+=OVERHEAD_BYTES_PER_FIELD + MANUFACTURER_SPECIFIC_DATA_LENGTH + byteLength(data.getManufacturerSpecificData().valueAt(i));
  }
  if (data.getIncludeTxPowerLevel()) {
    size+=OVERHEAD_BYTES_PER_FIELD + 1;
  }
  if (data.getIncludeDeviceName() && mBluetoothAdapter.getName() != null) {
    size+=OVERHEAD_BYTES_PER_FIELD + mBluetoothAdapter.getName().length();
  }
  return size;
}

Fixed version (ground truth):
private int totalBytes(AdvertiseData data){
  if (data == null)   return 0;
  int size=FLAGS_FIELD_BYTES;
  if (data.getServiceUuids() != null) {
    int num16BitUuids=0;
    int num32BitUuids=0;
    int num128BitUuids=0;
    for (    ParcelUuid uuid : data.getServiceUuids()) {
      if (BluetoothUuid.is16BitUuid(uuid)) {
        ++num16BitUuids;
      }
 else       if (BluetoothUuid.is32BitUuid(uuid)) {
        ++num32BitUuids;
      }
 else {
        ++num128BitUuids;
      }
    }
    if (num16BitUuids != 0) {
      size+=OVERHEAD_BYTES_PER_FIELD + num16BitUuids * BluetoothUuid.UUID_BYTES_16_BIT;
    }
    if (num32BitUuids != 0) {
      size+=OVERHEAD_BYTES_PER_FIELD + num32BitUuids * BluetoothUuid.UUID_BYTES_32_BIT;
    }
    if (num128BitUuids != 0) {
      size+=OVERHEAD_BYTES_PER_FIELD + num128BitUuids * BluetoothUuid.UUID_BYTES_128_BIT;
    }
  }
  for (  ParcelUuid uuid : data.getServiceData().keySet()) {
    size+=OVERHEAD_BYTES_PER_FIELD + SERVICE_DATA_UUID_LENGTH + byteLength(data.getServiceData().get(uuid));
  }
  for (int i=0; i < data.getManufacturerSpecificData().size(); ++i) {
    size+=OVERHEAD_BYTES_PER_FIELD + MANUFACTURER_SPECIFIC_DATA_LENGTH + byteLength(data.getManufacturerSpecificData().valueAt(i));
  }
  if (data.getIncludeTxPowerLevel()) {
    size+=OVERHEAD_BYTES_PER_FIELD + 1;
  }
  if (data.getIncludeDeviceName() && mBluetoothAdapter.getName() != null) {
    size+=OVERHEAD_BYTES_PER_FIELD + mBluetoothAdapter.getName().length();
  }
  return size;
}
Program: 198223
Project: 198223
Buggy source:
@Override public void run(){
  callback.onStartFailure(error);
}

Fixed version (ground truth):
@Override public void run(){
  callback.onStartSuccess(settings);
}
Program: 198225
Project: 198225
Buggy source:
/** 
 * Stop Bluetooth LE advertising. The   {@code callback} must be the same one use in{@link BluetoothLeAdvertiser#startAdvertising}. <p> Requires   {@link android.Manifest.permission#BLUETOOTH_ADMIN} permission.
 * @param callback {@link AdvertiseCallback} identifies the advertising instance to stop.
 */
public void stopAdvertising(final AdvertiseCallback callback){
  checkAdapterState();
  if (callback == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  AdvertiseCallbackWrapper wrapper=mLeAdvertisers.get(callback);
  if (wrapper == null)   return;
  try {
    IBluetoothGatt gatt=mBluetoothManager.getBluetoothGatt();
    if (gatt != null)     gatt.stopMultiAdvertising(wrapper.mClientIf);
    if (wrapper.advertiseStopped()) {
      mLeAdvertisers.remove(callback);
    }
  }
 catch (  RemoteException e) {
    Log.e(TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void stopAdvertising(){
synchronized (this) {
    try {
      mBluetoothGatt.stopMultiAdvertising(mClientIf);
      wait(LE_CALLBACK_TIMEOUT_MILLIS);
    }
 catch (    InterruptedException|RemoteException e) {
      Log.e(TAG,"String_Node_Str",e);
    }
    if (mLeAdvertisers.containsKey(mAdvertiseCallback)) {
      mLeAdvertisers.remove(mAdvertiseCallback);
    }
  }
}
Program: 198226
Project: 198226
Buggy source:
/** 
 * Application interface registered - app is ready to go
 */
@Override public void onClientRegistered(int status,int clientIf){
  Log.d(TAG,"String_Node_Str" + status + "String_Node_Str"+ clientIf);
synchronized (this) {
    if (status == BluetoothGatt.GATT_SUCCESS) {
      mClientIf=clientIf;
      try {
        mBluetoothGatt.startMultiAdvertising(mClientIf,mAdvertisement,mScanResponse,mSettings);
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str" + e);
        mClientIf=-1;
        notifyAll();
      }
    }
 else {
      mClientIf=-1;
      notifyAll();
    }
  }
}

Fixed version (ground truth):
/** 
 * Application interface registered - app is ready to go
 */
@Override public void onClientRegistered(int status,int clientIf){
  Log.d(TAG,"String_Node_Str" + status + "String_Node_Str"+ clientIf);
synchronized (this) {
    if (status == BluetoothGatt.GATT_SUCCESS) {
      mClientIf=clientIf;
      try {
        mBluetoothGatt.startMultiAdvertising(mClientIf,mAdvertisement,mScanResponse,mSettings);
        return;
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
    mClientIf=-1;
    notifyAll();
  }
}
Program: 198227
Project: 198227
Buggy source:
@Override public void onMultiAdvertiseCallback(int status,boolean isStart,AdvertiseSettings settings){
synchronized (this) {
    if (isStart) {
      if (status == AdvertiseCallback.ADVERTISE_SUCCESS) {
        mAdvertiseCallback.onStartSuccess(settings);
        mIsAdvertising=true;
      }
 else {
        mAdvertiseCallback.onStartFailure(status);
      }
    }
 else {
      try {
        mBluetoothGatt.unregisterClient(mClientIf);
        mClientIf=-1;
        mIsAdvertising=false;
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
    notifyAll();
  }
}

Fixed version (ground truth):
@Override public void onMultiAdvertiseCallback(int status,boolean isStart,AdvertiseSettings settings){
synchronized (this) {
    if (isStart) {
      if (status == AdvertiseCallback.ADVERTISE_SUCCESS) {
        mIsAdvertising=true;
        postStartSuccess(mAdvertiseCallback,settings);
      }
 else {
        postStartFailure(mAdvertiseCallback,status);
      }
    }
 else {
      try {
        mBluetoothGatt.unregisterClient(mClientIf);
        mClientIf=-1;
        mIsAdvertising=false;
        mLeAdvertisers.remove(mAdvertiseCallback);
      }
 catch (      RemoteException e) {
        Log.e(TAG,"String_Node_Str",e);
      }
    }
    notifyAll();
  }
}