nus-yam/ex-repair huggingface dataset:
Program: 92494
Project: 92494
Buggy source:
public <ActivityType extends AppCompatActivity & FileCallback>Builder(@NonNull ActivityType context){
  mContext=context;
  mCancelButton=android.R.string.cancel;
  mChooseButton=R.string.md_choose_label;
  mInitialPath=Environment.getExternalStorageDirectory().getAbsolutePath();
  mMimeType=null;
}

Fixed version (ground truth):
public <ActivityType extends AppCompatActivity & FileCallback>Builder(@NonNull ActivityType context){
  mContext=context;
  mCancelButton=android.R.string.cancel;
  mInitialPath=Environment.getExternalStorageDirectory().getAbsolutePath();
  mMimeType=null;
}
Program: 92495
Project: 92495
Buggy source:
@SuppressWarnings("String_Node_Str") @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState){
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && ActivityCompat.checkSelfPermission(getActivity(),Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
    return new MaterialDialog.Builder(getActivity()).title(R.string.md_error_label).content(R.string.md_storage_perm_error).positiveText(android.R.string.ok).build();
  }
  if (getArguments() == null || !getArguments().containsKey("String_Node_Str"))   throw new IllegalStateException("String_Node_Str");
  if (!getArguments().containsKey("String_Node_Str"))   getArguments().putString("String_Node_Str",getBuilder().mInitialPath);
  parentFolder=new File(getArguments().getString("String_Node_Str"));
  parentContents=listFiles(getBuilder().mMimeType);
  return new MaterialDialog.Builder(getActivity()).title(parentFolder.getAbsolutePath()).items(getContentsArray()).itemsCallback(this).onNegative(new MaterialDialog.SingleButtonCallback(){
    @Override public void onClick(    @NonNull MaterialDialog dialog,    @NonNull DialogAction which){
      dialog.dismiss();
    }
  }
).autoDismiss(false).negativeText(getBuilder().mCancelButton).positiveText(getBuilder().mChooseButton).build();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState){
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && ActivityCompat.checkSelfPermission(getActivity(),Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
    return new MaterialDialog.Builder(getActivity()).title(R.string.md_error_label).content(R.string.md_storage_perm_error).positiveText(android.R.string.ok).build();
  }
  if (getArguments() == null || !getArguments().containsKey("String_Node_Str"))   throw new IllegalStateException("String_Node_Str");
  if (!getArguments().containsKey("String_Node_Str"))   getArguments().putString("String_Node_Str",getBuilder().mInitialPath);
  parentFolder=new File(getArguments().getString("String_Node_Str"));
  parentContents=listFiles(getBuilder().mMimeType);
  return new MaterialDialog.Builder(getActivity()).title(parentFolder.getAbsolutePath()).items(getContentsArray()).itemsCallback(this).onNegative(new MaterialDialog.SingleButtonCallback(){
    @Override public void onClick(    @NonNull MaterialDialog dialog,    @NonNull DialogAction which){
      dialog.dismiss();
    }
  }
).autoDismiss(false).negativeText(getBuilder().mCancelButton).build();
}
Program: 92496
Project: 92496
Buggy source:
@SuppressLint("String_Node_Str") @Override public View getView(int position,View convertView,ViewGroup parent){
  if (convertView == null)   convertView=View.inflate(mContext,R.layout.dialog_customlistitem,null);
  ((TextView)convertView.findViewById(R.id.md_title)).setText(mItems[position] + "String_Node_Str" + position+ "String_Node_Str");
  Button button=(Button)convertView.findViewById(R.id.button);
  button.setTag(position);
  button.setOnClickListener(this);
  return convertView;
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") @Override public View getView(int position,View convertView,ViewGroup parent){
  if (convertView == null)   convertView=View.inflate(mContext,R.layout.dialog_customlistitem,null);
  ((TextView)convertView.findViewById(R.id.md_title)).setText(mItems[position] + "String_Node_Str" + position+ "String_Node_Str");
  Button button=(Button)convertView.findViewById(R.id.md_button);
  button.setTag(position);
  button.setOnClickListener(this);
  return convertView;
}
Program: 92500
Project: 92500
Buggy source:
@SuppressWarnings("String_Node_Str") @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState){
  if (ActivityCompat.checkSelfPermission(getActivity(),Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
    return new MaterialDialog.Builder(getActivity()).title(R.string.md_error_label).content(R.string.md_storage_perm_error).positiveText(android.R.string.ok).build();
  }
  if (getArguments() == null || !getArguments().containsKey("String_Node_Str"))   throw new IllegalStateException("String_Node_Str");
  if (!getArguments().containsKey("String_Node_Str"))   getArguments().putString("String_Node_Str",getBuilder().mInitialPath);
  parentFolder=new File(getArguments().getString("String_Node_Str"));
  parentContents=listFiles();
  return new MaterialDialog.Builder(getActivity()).title(parentFolder.getAbsolutePath()).items(getContentsArray()).itemsCallback(this).onPositive(new MaterialDialog.SingleButtonCallback(){
    @Override public void onClick(    @NonNull MaterialDialog dialog,    @NonNull DialogAction which){
      dialog.dismiss();
      mCallback.onFolderSelection(parentFolder);
    }
  }
).onNegative(new MaterialDialog.SingleButtonCallback(){
    @Override public void onClick(    @NonNull MaterialDialog dialog,    @NonNull DialogAction which){
      dialog.dismiss();
    }
  }
).autoDismiss(false).positiveText(getBuilder().mChooseButton).negativeText(getBuilder().mCancelButton).build();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState){
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && ActivityCompat.checkSelfPermission(getActivity(),Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
    return new MaterialDialog.Builder(getActivity()).title(R.string.md_error_label).content(R.string.md_storage_perm_error).positiveText(android.R.string.ok).build();
  }
  if (getArguments() == null || !getArguments().containsKey("String_Node_Str"))   throw new IllegalStateException("String_Node_Str");
  if (!getArguments().containsKey("String_Node_Str"))   getArguments().putString("String_Node_Str",getBuilder().mInitialPath);
  parentFolder=new File(getArguments().getString("String_Node_Str"));
  parentContents=listFiles();
  return new MaterialDialog.Builder(getActivity()).title(parentFolder.getAbsolutePath()).items(getContentsArray()).itemsCallback(this).onPositive(new MaterialDialog.SingleButtonCallback(){
    @Override public void onClick(    @NonNull MaterialDialog dialog,    @NonNull DialogAction which){
      dialog.dismiss();
      mCallback.onFolderSelection(parentFolder);
    }
  }
).onNegative(new MaterialDialog.SingleButtonCallback(){
    @Override public void onClick(    @NonNull MaterialDialog dialog,    @NonNull DialogAction which){
      dialog.dismiss();
    }
  }
).autoDismiss(false).positiveText(getBuilder().mChooseButton).negativeText(getBuilder().mCancelButton).build();
}
Program: 92501
Project: 92501
Buggy source:
protected void invalidateInputMinMaxIndicator(int currentLength,boolean emptyDisabled){
  if (inputMinMax != null) {
    inputMinMax.setText(currentLength + "String_Node_Str" + mBuilder.inputMaxLength);
    final boolean isDisabled=emptyDisabled || currentLength > mBuilder.inputMaxLength;
    final int colorText=isDisabled ? mBuilder.inputMaxLengthErrorColor : mBuilder.contentColor;
    final int colorWidget=isDisabled ? mBuilder.inputMaxLengthErrorColor : mBuilder.widgetColor;
    inputMinMax.setTextColor(colorText);
    MDTintHelper.setTint(input,colorWidget);
    final View positiveAb=getActionButton(DialogAction.POSITIVE);
    positiveAb.setEnabled(!isDisabled);
  }
}

Fixed version (ground truth):
protected void invalidateInputMinMaxIndicator(int currentLength,boolean emptyDisabled){
  if (inputMinMax != null) {
    inputMinMax.setText(currentLength + "String_Node_Str" + mBuilder.inputMaxLength);
    final boolean isDisabled=(emptyDisabled && currentLength == 0) || currentLength > mBuilder.inputMaxLength;
    final int colorText=isDisabled ? mBuilder.inputMaxLengthErrorColor : mBuilder.contentColor;
    final int colorWidget=isDisabled ? mBuilder.inputMaxLengthErrorColor : mBuilder.widgetColor;
    inputMinMax.setTextColor(colorText);
    MDTintHelper.setTint(input,colorWidget);
    final View positiveAb=getActionButton(DialogAction.POSITIVE);
    positiveAb.setEnabled(!isDisabled);
  }
}
Program: 92502
Project: 92502
Buggy source:
public static int getTheme(MaterialDialog.Builder builder){
  boolean darkTheme=builder.theme == Theme.DARK;
  if (!darkTheme) {
    darkTheme=DialogUtils.resolveBoolean(builder.context,R.attr.md_dark_theme,false);
    builder.theme=darkTheme ? Theme.DARK : Theme.LIGHT;
  }
  return darkTheme ? R.style.MD_Dark : R.style.MD_Light;
}

Fixed version (ground truth):
public static int getTheme(MaterialDialog.Builder builder){
  boolean darkTheme=DialogUtils.resolveBoolean(builder.context,R.attr.md_dark_theme,builder.theme == Theme.DARK);
  builder.theme=darkTheme ? Theme.DARK : Theme.LIGHT;
  return darkTheme ? R.style.MD_Dark : R.style.MD_Light;
}
Program: 92503
Project: 92503
Buggy source:
public static ContextThemeWrapper getTheme(MaterialDialog.Builder builder){
  boolean darkTheme=builder.theme == Theme.DARK;
  if (!darkTheme) {
    darkTheme=DialogUtils.resolveBoolean(builder.context,R.attr.md_dark_theme,false);
    builder.theme=darkTheme ? Theme.DARK : Theme.LIGHT;
  }
  return new ContextThemeWrapper(builder.context,darkTheme ? R.style.MD_Dark : R.style.MD_Light);
}

Fixed version (ground truth):
public static int getTheme(MaterialDialog.Builder builder){
  boolean darkTheme=builder.theme == Theme.DARK;
  if (!darkTheme) {
    darkTheme=DialogUtils.resolveBoolean(builder.context,R.attr.md_dark_theme,false);
    builder.theme=darkTheme ? Theme.DARK : Theme.LIGHT;
  }
  return darkTheme ? R.style.MD_Dark : R.style.MD_Light;
}
Program: 92504
Project: 92504
Buggy source:
@SuppressLint("String_Node_Str") protected MaterialDialog(Builder builder){
  super(DialogInit.getTheme(builder));
  mBuilder=builder;
  final LayoutInflater inflater=LayoutInflater.from(mBuilder.context);
  view=(MDRootLayout)inflater.inflate(DialogInit.getInflateLayout(builder),null);
  DialogInit.init(this);
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") protected MaterialDialog(Builder builder){
  super(builder.context,DialogInit.getTheme(builder));
  mBuilder=builder;
  final LayoutInflater inflater=LayoutInflater.from(mBuilder.context);
  view=(MDRootLayout)inflater.inflate(DialogInit.getInflateLayout(builder),null);
  DialogInit.init(this);
}
Program: 92505
Project: 92505
Buggy source:
protected DialogBase(Context context){
  super(context);
}

Fixed version (ground truth):
protected DialogBase(Context context,int theme){
  super(context,theme);
}
Program: 92507
Project: 92507
Buggy source:
@Override public void onScrollChanged(){
  boolean canScroll=canRecyclerViewScroll(rv);
  invalidateDividersVisibility(canScroll,rv);
}

Fixed version (ground truth):
@Override public void onScrollChanged(){
  invalidateDividersForScrollingView(vg,topAndBottom,bottom);
}
Program: 92509
Project: 92509
Buggy source:
/** 
 * Find the view touching the bottom of this ViewGroup. Non visible children are ignored, however getChildDrawingOrder is not taking into account for simplicity and because it behaves inconsistently across platform versions.
 * @return View touching the bottom of this viewgroup or null
 */
@Nullable private static View getBottomView(ViewGroup viewGroup){
  if (viewGroup == null)   return null;
  View bottomView=null;
  for (int i=viewGroup.getChildCount() - 1; i >= 0; i--) {
    View child=viewGroup.getChildAt(i);
    if (child.getVisibility() == View.VISIBLE && child.getBottom() == viewGroup.getMeasuredHeight()) {
      bottomView=child;
      break;
    }
  }
  return bottomView;
}

Fixed version (ground truth):
/** 
 * Find the view touching the bottom of this ViewGroup. Non visible children are ignored, however getChildDrawingOrder is not taking into account for simplicity and because it behaves inconsistently across platform versions.
 * @return View touching the bottom of this ViewGroup or null
 */
@Nullable private static View getBottomView(ViewGroup viewGroup){
  if (viewGroup == null)   return null;
  View bottomView=null;
  for (int i=viewGroup.getChildCount() - 1; i >= 0; i--) {
    View child=viewGroup.getChildAt(i);
    if (child.getVisibility() == View.VISIBLE && child.getBottom() == viewGroup.getMeasuredHeight()) {
      bottomView=child;
      break;
    }
  }
  return bottomView;
}
Program: 92510
Project: 92510
Buggy source:
/** 
 * Set if the button should be displayed in stacked mode. This should only be called from MDRootLayout's onMeasure, and we must be measured after calling this.
 */
void setStacked(boolean stacked,boolean force){
  if (mStacked != stacked || force) {
    setGravity(stacked ? (Gravity.CENTER_VERTICAL | mStackedGravity.getGravityInt()) : Gravity.CENTER);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
      setTextAlignment(stacked ? mStackedGravity.getTextAlignment() : TEXT_ALIGNMENT_CENTER);
    }
    DialogUtils.setBackgroundCompat(this,stacked ? mStackedBackground : mDefaultBackground);
    if (stacked) {
      setPadding(mStackedEndPadding,getPaddingTop(),mStackedEndPadding,getPaddingBottom());
    }
  }
}

Fixed version (ground truth):
/** 
 * Set if the button should be displayed in stacked mode. This should only be called from MDRootLayout's onMeasure, and we must be measured after calling this.
 */
void setStacked(boolean stacked,boolean force){
  if (mStacked != stacked || force) {
    setGravity(stacked ? (Gravity.CENTER_VERTICAL | mStackedGravity.getGravityInt()) : Gravity.CENTER);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
      setTextAlignment(stacked ? mStackedGravity.getTextAlignment() : TEXT_ALIGNMENT_CENTER);
    }
    DialogUtils.setBackgroundCompat(this,stacked ? mStackedBackground : mDefaultBackground);
    if (stacked) {
      setPadding(mStackedEndPadding,getPaddingTop(),mStackedEndPadding,getPaddingBottom());
    }
    mStacked=stacked;
  }
}
Program: 92511
Project: 92511
Buggy source:
public void setDefaultSelector(Drawable d){
  mDefaultBackground=d;
  if (!mStacked)   setStacked(true,true);
}

Fixed version (ground truth):
public void setDefaultSelector(Drawable d){
  mDefaultBackground=d;
  if (!mStacked)   setStacked(false,true);
}
Program: 92513
Project: 92513
Buggy source:
/** 
 * Measures the action button's and their text to decide whether or not the button should be stacked.
 */
private void checkIfStackingNeeded(){
  if (numberOfActionButtons() <= 1) {
    return;
  }
 else   if (mBuilder.forceStacking) {
    isStacked=true;
  }
 else {
    isStacked=false;
    int buttonsWidth=0;
    positiveButton.measure(View.MeasureSpec.UNSPECIFIED,View.MeasureSpec.UNSPECIFIED);
    neutralButton.measure(View.MeasureSpec.UNSPECIFIED,View.MeasureSpec.UNSPECIFIED);
    negativeButton.measure(View.MeasureSpec.UNSPECIFIED,View.MeasureSpec.UNSPECIFIED);
    if (mBuilder.positiveText != null)     buttonsWidth+=positiveButton.getMeasuredWidth();
    if (mBuilder.neutralText != null)     buttonsWidth+=neutralButton.getMeasuredWidth();
    if (mBuilder.negativeText != null)     buttonsWidth+=negativeButton.getMeasuredWidth();
    final int buttonFrameWidth=view.findViewById(R.id.buttonDefaultFrame).getWidth();
    isStacked=buttonsWidth > buttonFrameWidth;
  }
  invalidateActions();
  if (isStacked) {
    positiveButton.setVisibility(mBuilder.positiveText != null ? View.VISIBLE : View.GONE);
    neutralButton.setVisibility(mBuilder.neutralText != null ? View.VISIBLE : View.GONE);
    negativeButton.setVisibility(mBuilder.negativeText != null ? View.VISIBLE : View.GONE);
  }
}

Fixed version (ground truth):
/** 
 * Measures the action button's and their text to decide whether or not the button should be stacked.
 */
private void checkIfStackingNeeded(){
  if (numberOfActionButtons() <= 1) {
    invalidateActions();
    return;
  }
 else   if (mBuilder.forceStacking) {
    isStacked=true;
  }
 else {
    isStacked=false;
    int buttonsWidth=0;
    positiveButton.measure(View.MeasureSpec.UNSPECIFIED,View.MeasureSpec.UNSPECIFIED);
    neutralButton.measure(View.MeasureSpec.UNSPECIFIED,View.MeasureSpec.UNSPECIFIED);
    negativeButton.measure(View.MeasureSpec.UNSPECIFIED,View.MeasureSpec.UNSPECIFIED);
    if (mBuilder.positiveText != null)     buttonsWidth+=positiveButton.getMeasuredWidth();
    if (mBuilder.neutralText != null)     buttonsWidth+=neutralButton.getMeasuredWidth();
    if (mBuilder.negativeText != null)     buttonsWidth+=negativeButton.getMeasuredWidth();
    final int buttonFrameWidth=view.findViewById(R.id.buttonDefaultFrame).getWidth();
    isStacked=buttonsWidth > buttonFrameWidth;
  }
  invalidateActions();
  if (isStacked) {
    positiveButton.setVisibility(mBuilder.positiveText != null ? View.VISIBLE : View.GONE);
    neutralButton.setVisibility(mBuilder.neutralText != null ? View.VISIBLE : View.GONE);
    negativeButton.setVisibility(mBuilder.negativeText != null ? View.VISIBLE : View.GONE);
  }
}
Program: 92514
Project: 92514
Buggy source:
/** 
 * Constructs the dialog's list content and sets up click listeners.
 */
private void invalidateList(){
  if ((mBuilder.items == null || mBuilder.items.length == 0) && mBuilder.adapter == null)   return;
  view.findViewById(R.id.contentScrollView).setVisibility(mBuilder.content != null && mBuilder.content.toString().trim().length() > 0 ? View.VISIBLE : View.GONE);
  listView.setAdapter(mBuilder.adapter);
  if (listType != null || mBuilder.listCallbackCustom != null)   listView.setOnItemClickListener(this);
}

Fixed version (ground truth):
/** 
 * Sets the dialog ListView's adapter and it's item click listener.
 */
protected final void invalidateList(){
  if ((mBuilder.items == null || mBuilder.items.length == 0) && mBuilder.adapter == null)   return;
  listView.setAdapter(mBuilder.adapter);
  if (listType != null || mBuilder.listCallbackCustom != null)   listView.setOnItemClickListener(this);
}
Program: 92519
Project: 92519
Buggy source:
public Builder titleColor(int color){
  this.titleColor=color;
  return this;
}

Fixed version (ground truth):
public Builder titleColor(int color){
  this.titleColor=color;
  this.titleColorSet=true;
  return this;
}
Program: 92520
Project: 92520
Buggy source:
public Builder contentColor(int color){
  this.contentColor=color;
  return this;
}

Fixed version (ground truth):
public Builder contentColor(int color){
  this.contentColor=color;
  this.contentColorSet=true;
  return this;
}
Program: 92521
Project: 92521
Buggy source:
public Builder itemColor(int color){
  this.itemColor=color;
  return this;
}

Fixed version (ground truth):
public Builder itemColor(int color){
  this.itemColor=color;
  this.itemColorSet=true;
  return this;
}
Program: 92523
Project: 92523
Buggy source:
/** 
 * Convenience method for setting the currently selected index of a single choice list. This only works if you are not using a custom adapter; if you're using a custom adapter, an IllegalStateException is thrown. <p/> Note that this does not call the respective single choice callback.
 * @param index The index of the list item to check.
 */
public void setSelectedIndex(int index){
  mBuilder.selectedIndex=index;
  if (mBuilder.adapter != null && mBuilder.adapter instanceof MaterialDialogAdapter) {
    ((MaterialDialogAdapter)mBuilder.adapter).notifyDataSetChanged();
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Convenience method for setting the currently selected index of a single choice list. This only works if you are not using a custom adapter; if you're using a custom adapter, an IllegalStateException is thrown. Note that this does not call the respective single choice callback.
 * @param index The index of the list item to check.
 */
public void setSelectedIndex(int index){
  mBuilder.selectedIndex=index;
  if (mBuilder.adapter != null && mBuilder.adapter instanceof MaterialDialogAdapter) {
    ((MaterialDialogAdapter)mBuilder.adapter).notifyDataSetChanged();
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
}
Program: 92524
Project: 92524
Buggy source:
/** 
 * Convenience method for setting the currently selected indices of a multi choice list. This only works if you are not using a custom adapter; if you're using a custom adapter, an IllegalStateException is thrown. <p/> Note that this does not call the respective multi choice callback.
 * @param indices The indices of the list items to check.
 */
public void setSelectedIndices(Integer[] indices){
  mBuilder.selectedIndices=indices;
  selectedIndicesList=new ArrayList<>(Arrays.asList(indices));
  if (mBuilder.adapter != null && mBuilder.adapter instanceof MaterialDialogAdapter) {
    ((MaterialDialogAdapter)mBuilder.adapter).notifyDataSetChanged();
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Convenience method for setting the currently selected indices of a multi choice list. This only works if you are not using a custom adapter; if you're using a custom adapter, an IllegalStateException is thrown. Note that this does not call the respective multi choice callback.
 * @param indices The indices of the list items to check.
 */
public void setSelectedIndices(Integer[] indices){
  mBuilder.selectedIndices=indices;
  selectedIndicesList=new ArrayList<>(Arrays.asList(indices));
  if (mBuilder.adapter != null && mBuilder.adapter instanceof MaterialDialogAdapter) {
    ((MaterialDialogAdapter)mBuilder.adapter).notifyDataSetChanged();
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
}
Program: 92525
Project: 92525
Buggy source:
/** 
 * Measures the action button's and their text to decide whether or not the button should be stacked.
 */
private void checkIfStackingNeeded(){
  if (numberOfActionButtons() <= 1) {
    return;
  }
 else   if (mBuilder.forceStacking) {
    isStacked=true;
    invalidateActions();
    return;
  }
  isStacked=false;
  int buttonsWidth=0;
  if (mBuilder.positiveText != null)   buttonsWidth+=positiveButton.getWidth();
  if (mBuilder.neutralText != null)   buttonsWidth+=neutralButton.getWidth();
  if (mBuilder.negativeText != null)   buttonsWidth+=negativeButton.getWidth();
  final int dialogWidth=getWindow().getDecorView().getMeasuredWidth();
  final int margins=(int)getContext().getResources().getDimension(R.dimen.md_button_padding_frame_side);
  final int effectiveDialogWidth=dialogWidth - 2 * margins;
  isStacked=buttonsWidth > effectiveDialogWidth;
  invalidateActions();
}

Fixed version (ground truth):
/** 
 * Measures the action button's and their text to decide whether or not the button should be stacked.
 */
private void checkIfStackingNeeded(){
  if (numberOfActionButtons() <= 1) {
    return;
  }
 else   if (mBuilder.forceStacking) {
    isStacked=true;
    invalidateActions();
    return;
  }
  isStacked=false;
  int buttonsWidth=0;
  if (mBuilder.positiveText != null)   buttonsWidth+=positiveButton.getWidth();
  if (mBuilder.neutralText != null)   buttonsWidth+=neutralButton.getWidth();
  if (mBuilder.negativeText != null)   buttonsWidth+=negativeButton.getWidth();
  final int buttonFrameWidth=view.findViewById(R.id.buttonDefaultFrame).getWidth();
  isStacked=buttonsWidth > buttonFrameWidth;
  invalidateActions();
}
Program: 92530
Project: 92530
Buggy source:
private void onRelease(boolean stayForLoading){
  tryToPerformRefresh();
  if (mStatus == PTR_STATUS_LOADING) {
    if (mKeepHeaderWhenRefresh) {
      if (mCurrentPos > mHeaderHeight && !stayForLoading) {
        int scrollHeight=mHeaderRetainHeightOnRefresh >= 0 ? mHeaderRetainHeightOnRefresh : mHeaderHeight;
        mScrollChecker.tryToScrollTo(scrollHeight,mDurationToClose);
      }
 else {
      }
    }
 else {
      tryScrollBackToTopWhileLoading();
    }
  }
 else {
    if (mStatus == PTR_STATUS_COMPLETE) {
      notifyUIRefreshComplete(false);
    }
 else {
      tryScrollBackToTopAbortRefresh();
    }
  }
}

Fixed version (ground truth):
private void onRelease(boolean stayForLoading){
  tryToPerformRefresh();
  if (mStatus == PTR_STATUS_LOADING) {
    if (mKeepHeaderWhenRefresh) {
      int scrollHeight=mHeaderRetainHeightOnRefresh >= 0 ? mHeaderRetainHeightOnRefresh : mHeaderHeight;
      if (mCurrentPos > scrollHeight && !stayForLoading) {
        mScrollChecker.tryToScrollTo(scrollHeight,mDurationToClose);
      }
 else {
      }
    }
 else {
      tryScrollBackToTopWhileLoading();
    }
  }
 else {
    if (mStatus == PTR_STATUS_COMPLETE) {
      notifyUIRefreshComplete(false);
    }
 else {
      tryScrollBackToTopAbortRefresh();
    }
  }
}
Program: 92532
Project: 92532
Buggy source:
@Override public boolean onTouchEvent(MotionEvent ev){
  if (mCallbacks != null) {
switch (ev.getActionMasked()) {
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
      mDragging=false;
    mCallbacks.onUpOrCancelMotionEvent(mScrollState);
  break;
}
}
return super.onTouchEvent(ev);
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent ev){
  if (mCallbacks != null) {
switch (ev.getActionMasked()) {
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
      mDragging=false;
    mCallbacks.onUpOrCancelMotionEvent(mScrollState);
  break;
case MotionEvent.ACTION_MOVE:
if (mPrevMoveEvent == null) {
  mPrevMoveEvent=ev;
}
float diffY=ev.getY() - mPrevMoveEvent.getY();
mPrevMoveEvent=MotionEvent.obtainNoHistory(ev);
if (getCurrentScrollY() - diffY <= 0) {
MotionEvent event=MotionEvent.obtainNoHistory(ev);
event.offsetLocation(getLeft(),getTop());
ViewGroup parent=(ViewGroup)getParent();
if (parent.onInterceptTouchEvent(event)) {
event.setAction(MotionEvent.ACTION_DOWN);
parent.dispatchTouchEvent(event);
}
return false;
}
}
}
return super.onTouchEvent(ev);
}
Program: 92533
Project: 92533
Buggy source:
@Override public boolean onTouchEvent(MotionEvent ev){
  if (mCallbacks != null) {
switch (ev.getActionMasked()) {
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
      mDragging=false;
    mCallbacks.onUpOrCancelMotionEvent(mScrollState);
  break;
}
}
return super.onTouchEvent(ev);
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent ev){
  if (mCallbacks != null) {
switch (ev.getActionMasked()) {
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
      mDragging=false;
    mCallbacks.onUpOrCancelMotionEvent(mScrollState);
  break;
case MotionEvent.ACTION_MOVE:
if (mPrevMoveEvent == null) {
  mPrevMoveEvent=ev;
}
float diffY=ev.getY() - mPrevMoveEvent.getY();
mPrevMoveEvent=MotionEvent.obtainNoHistory(ev);
if (getCurrentScrollY() - diffY <= 0) {
MotionEvent event=MotionEvent.obtainNoHistory(ev);
event.offsetLocation(getLeft(),getTop());
ViewGroup parent=(ViewGroup)getParent();
if (parent.onInterceptTouchEvent(event)) {
event.setAction(MotionEvent.ACTION_DOWN);
parent.dispatchTouchEvent(event);
}
return false;
}
break;
}
}
return super.onTouchEvent(ev);
}
Program: 92534
Project: 92534
Buggy source:
@Override public boolean onTouchEvent(MotionEvent ev){
  if (mCallbacks != null) {
switch (ev.getActionMasked()) {
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
      mDragging=false;
    mCallbacks.onUpOrCancelMotionEvent(mScrollState);
  break;
}
}
return super.onTouchEvent(ev);
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent ev){
  if (mCallbacks != null) {
switch (ev.getActionMasked()) {
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
      mDragging=false;
    mCallbacks.onUpOrCancelMotionEvent(mScrollState);
  break;
case MotionEvent.ACTION_MOVE:
if (mPrevMoveEvent == null) {
  mPrevMoveEvent=ev;
}
float diffY=ev.getY() - mPrevMoveEvent.getY();
mPrevMoveEvent=MotionEvent.obtainNoHistory(ev);
if (getCurrentScrollY() - diffY <= 0) {
MotionEvent event=MotionEvent.obtainNoHistory(ev);
event.offsetLocation(getLeft(),getTop());
ViewGroup parent=(ViewGroup)getParent();
if (parent.onInterceptTouchEvent(event)) {
event.setAction(MotionEvent.ACTION_DOWN);
parent.dispatchTouchEvent(event);
}
return false;
}
}
}
return super.onTouchEvent(ev);
}
Program: 92535
Project: 92535
Buggy source:
private void runEnterAnimation(View view,int position){
  if (position >= ANIMATED_ITEMS_COUNT - 1) {
    return;
  }
  if (position > lastAnimatedPosition) {
    lastAnimatedPosition=position;
    view.setTranslationY(Utils.getScreenHeight(context));
    view.animate().translationY(0).setInterpolator(new DecelerateInterpolator(3.f)).setDuration(700).start();
  }
}

Fixed version (ground truth):
private void runEnterAnimation(View view,int position){
  if (!animateItems || position >= ANIMATED_ITEMS_COUNT - 1) {
    return;
  }
  if (position > lastAnimatedPosition) {
    lastAnimatedPosition=position;
    view.setTranslationY(Utils.getScreenHeight(context));
    view.animate().translationY(0).setInterpolator(new DecelerateInterpolator(3.f)).setDuration(700).start();
  }
}
Program: 92536
Project: 92536
Buggy source:
public void updateItems(){
  itemsCount=10;
  notifyDataSetChanged();
}

Fixed version (ground truth):
public void updateItems(boolean animated){
  itemsCount=10;
  animateItems=animated;
  notifyDataSetChanged();
}
Program: 92537
Project: 92537
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  ButterKnife.inject(this);
  setupToolbar();
  setupFeed();
  if (savedInstanceState == null) {
    pendingIntroAnimation=true;
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  ButterKnife.inject(this);
  setupToolbar();
  setupFeed();
  if (savedInstanceState == null) {
    pendingIntroAnimation=true;
  }
 else {
    feedAdapter.updateItems(false);
  }
}
Program: 92538
Project: 92538
Buggy source:
private void startContentAnimation(){
  btnCreate.animate().translationY(0).setInterpolator(new OvershootInterpolator(1.f)).setStartDelay(300).setDuration(ANIM_DURATION_FAB).start();
  feedAdapter.updateItems();
}

Fixed version (ground truth):
private void startContentAnimation(){
  btnCreate.animate().translationY(0).setInterpolator(new OvershootInterpolator(1.f)).setStartDelay(300).setDuration(ANIM_DURATION_FAB).start();
  feedAdapter.updateItems(true);
}
Program: 92541
Project: 92541
Buggy source:
@Override public double[][] learn(double[] x,double[] y){
  double[][] data=dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
  int[] label=dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
  FLD fisher=new FLD(data,label);
  for (int i=0; i < label.length; i++) {
    label[i]=fisher.predict(data[i]);
  }
  double trainError=error(label,label);
  System.out.format("String_Node_Str",100 * trainError);
  double[][] z=new double[y.length][x.length];
  for (int i=0; i < y.length; i++) {
    for (int j=0; j < x.length; j++) {
      double[] p={x[j],y[i]};
      z[i][j]=fisher.predict(p);
    }
  }
  return z;
}

Fixed version (ground truth):
@Override public double[][] learn(double[] x,double[] y){
  double[][] data=dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
  int[] label=dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
  FLD fisher=new FLD(data,label);
  int[] pred=new int[label.length];
  for (int i=0; i < label.length; i++) {
    pred[i]=fisher.predict(data[i]);
  }
  double trainError=error(label,pred);
  System.out.format("String_Node_Str",100 * trainError);
  double[][] z=new double[y.length][x.length];
  for (int i=0; i < y.length; i++) {
    for (int j=0; j < x.length; j++) {
      double[] p={x[j],y[i]};
      z[i][j]=fisher.predict(p);
    }
  }
  return z;
}
Program: 92542
Project: 92542
Buggy source:
@Override public double[][] learn(double[] x,double[] y){
  try {
    k=Integer.parseInt(kField.getText().trim());
    if (k < 1) {
      JOptionPane.showMessageDialog(this,"String_Node_Str" + k,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return null;
    }
  }
 catch (  Exception ex) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + kField.getText(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    return null;
  }
  double[][] data=dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
  int[] label=dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
  KNN<double[]> knn=KNN.learn(data,label,k);
  int[] pred=new int[label.length];
  for (int i=0; i < label.length; i++) {
    pred[i]=knn.predict(data[i]);
  }
  double trainError=error(pred,label);
  System.out.format("String_Node_Str",100 * trainError);
  double[][] z=new double[y.length][x.length];
  for (int i=0; i < y.length; i++) {
    for (int j=0; j < x.length; j++) {
      double[] p={x[j],y[i]};
      z[i][j]=knn.predict(p);
    }
  }
  return z;
}

Fixed version (ground truth):
@Override public double[][] learn(double[] x,double[] y){
  try {
    k=Integer.parseInt(kField.getText().trim());
    if (k < 1) {
      JOptionPane.showMessageDialog(this,"String_Node_Str" + k,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return null;
    }
  }
 catch (  Exception ex) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + kField.getText(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    return null;
  }
  double[][] data=dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
  int[] label=dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
  KNN<double[]> knn=KNN.learn(data,label,k);
  int[] pred=new int[label.length];
  for (int i=0; i < label.length; i++) {
    pred[i]=knn.predict(data[i]);
  }
  double trainError=error(label,pred);
  System.out.format("String_Node_Str",100 * trainError);
  double[][] z=new double[y.length][x.length];
  for (int i=0; i < y.length; i++) {
    for (int j=0; j < x.length; j++) {
      double[] p={x[j],y[i]};
      z[i][j]=knn.predict(p);
    }
  }
  return z;
}
Program: 92543
Project: 92543
Buggy source:
@Override public double[][] learn(double[] x,double[] y){
  double[][] data=dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
  int[] label=dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
  LDA lda=new LDA(data,label);
  for (int i=0; i < label.length; i++) {
    label[i]=lda.predict(data[i]);
  }
  double trainError=error(label,label);
  System.out.format("String_Node_Str",100 * trainError);
  double[][] z=new double[y.length][x.length];
  for (int i=0; i < y.length; i++) {
    for (int j=0; j < x.length; j++) {
      double[] p={x[j],y[i]};
      z[i][j]=lda.predict(p);
    }
  }
  return z;
}

Fixed version (ground truth):
@Override public double[][] learn(double[] x,double[] y){
  double[][] data=dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
  int[] label=dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
  LDA lda=new LDA(data,label);
  int[] pred=new int[label.length];
  for (int i=0; i < label.length; i++) {
    pred[i]=lda.predict(data[i]);
  }
  double trainError=error(label,pred);
  System.out.format("String_Node_Str",100 * trainError);
  double[][] z=new double[y.length][x.length];
  for (int i=0; i < y.length; i++) {
    for (int j=0; j < x.length; j++) {
      double[] p={x[j],y[i]};
      z[i][j]=lda.predict(p);
    }
  }
  return z;
}
Program: 92544
Project: 92544
Buggy source:
@Override public double[][] learn(double[] x,double[] y){
  try {
    lambda=Double.parseDouble(lambdaField.getText().trim());
    if (lambda < 0.0) {
      JOptionPane.showMessageDialog(this,"String_Node_Str" + lambda,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return null;
    }
  }
 catch (  Exception ex) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + lambdaField.getText(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    return null;
  }
  double[][] data=dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
  int[] label=dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
  LogisticRegression logit=new LogisticRegression(data,label,lambda);
  for (int i=0; i < label.length; i++) {
    label[i]=logit.predict(data[i]);
  }
  double trainError=error(label,label);
  System.out.format("String_Node_Str",100 * trainError);
  double[][] z=new double[y.length][x.length];
  for (int i=0; i < y.length; i++) {
    for (int j=0; j < x.length; j++) {
      double[] p={x[j],y[i]};
      z[i][j]=logit.predict(p);
    }
  }
  return z;
}

Fixed version (ground truth):
@Override public double[][] learn(double[] x,double[] y){
  try {
    lambda=Double.parseDouble(lambdaField.getText().trim());
    if (lambda < 0.0) {
      JOptionPane.showMessageDialog(this,"String_Node_Str" + lambda,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return null;
    }
  }
 catch (  Exception ex) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + lambdaField.getText(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    return null;
  }
  double[][] data=dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
  int[] label=dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
  LogisticRegression logit=new LogisticRegression(data,label,lambda);
  int[] pred=new int[label.length];
  for (int i=0; i < label.length; i++) {
    pred[i]=logit.predict(data[i]);
  }
  double trainError=error(label,pred);
  System.out.format("String_Node_Str",100 * trainError);
  double[][] z=new double[y.length][x.length];
  for (int i=0; i < y.length; i++) {
    for (int j=0; j < x.length; j++) {
      double[] p={x[j],y[i]};
      z[i][j]=logit.predict(p);
    }
  }
  return z;
}
Program: 92546
Project: 92546
Buggy source:
@Override public double[][] learn(double[] x,double[] y){
  double[][] data=dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
  int[] label=dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
  QDA qda=new QDA(data,label);
  for (int i=0; i < label.length; i++) {
    label[i]=qda.predict(data[i]);
  }
  double trainError=error(label,label);
  System.out.format("String_Node_Str",100 * trainError);
  double[][] z=new double[y.length][x.length];
  for (int i=0; i < y.length; i++) {
    for (int j=0; j < x.length; j++) {
      double[] p={x[j],y[i]};
      z[i][j]=qda.predict(p);
    }
  }
  return z;
}

Fixed version (ground truth):
@Override public double[][] learn(double[] x,double[] y){
  double[][] data=dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
  int[] label=dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
  QDA qda=new QDA(data,label);
  int[] pred=new int[label.length];
  for (int i=0; i < label.length; i++) {
    pred[i]=qda.predict(data[i]);
  }
  double trainError=error(label,pred);
  System.out.format("String_Node_Str",100 * trainError);
  double[][] z=new double[y.length][x.length];
  for (int i=0; i < y.length; i++) {
    for (int j=0; j < x.length; j++) {
      double[] p={x[j],y[i]};
      z[i][j]=qda.predict(p);
    }
  }
  return z;
}
Program: 92547
Project: 92547
Buggy source:
@Override public double[][] learn(double[] x,double[] y){
  double[][] data=dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
  int[] label=dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
  try {
    k=Integer.parseInt(kField.getText().trim());
    if (k < 2 || k > data.length) {
      JOptionPane.showMessageDialog(this,"String_Node_Str" + k,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return null;
    }
  }
 catch (  Exception ex) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + kField.getText(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    return null;
  }
  double[][] centers=new double[k][];
  RadialBasisFunction basis=SmileUtils.learnGaussianRadialBasis(data,centers);
  RBFNetwork<double[]> rbf=new RBFNetwork<>(data,label,new EuclideanDistance(),basis,centers);
  for (int i=0; i < label.length; i++) {
    label[i]=rbf.predict(data[i]);
  }
  double trainError=error(label,label);
  System.out.format("String_Node_Str",100 * trainError);
  double[][] z=new double[y.length][x.length];
  for (int i=0; i < y.length; i++) {
    for (int j=0; j < x.length; j++) {
      double[] p={x[j],y[i]};
      z[i][j]=rbf.predict(p);
    }
  }
  return z;
}

Fixed version (ground truth):
@Override public double[][] learn(double[] x,double[] y){
  double[][] data=dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
  int[] label=dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
  try {
    k=Integer.parseInt(kField.getText().trim());
    if (k < 2 || k > data.length) {
      JOptionPane.showMessageDialog(this,"String_Node_Str" + k,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return null;
    }
  }
 catch (  Exception ex) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + kField.getText(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    return null;
  }
  double[][] centers=new double[k][];
  RadialBasisFunction basis=SmileUtils.learnGaussianRadialBasis(data,centers);
  RBFNetwork<double[]> rbf=new RBFNetwork<>(data,label,new EuclideanDistance(),basis,centers);
  int[] pred=new int[label.length];
  for (int i=0; i < label.length; i++) {
    pred[i]=rbf.predict(data[i]);
  }
  double trainError=error(label,pred);
  System.out.format("String_Node_Str",100 * trainError);
  double[][] z=new double[y.length][x.length];
  for (int i=0; i < y.length; i++) {
    for (int j=0; j < x.length; j++) {
      double[] p={x[j],y[i]};
      z[i][j]=rbf.predict(p);
    }
  }
  return z;
}
Program: 92548
Project: 92548
Buggy source:
@Override public double[][] learn(double[] x,double[] y){
  try {
    alpha=Double.parseDouble(alphaField.getText().trim());
    if (alpha < 0 || alpha > 1) {
      JOptionPane.showMessageDialog(this,"String_Node_Str" + alpha,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return null;
    }
  }
 catch (  Exception ex) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + alphaField.getText(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    return null;
  }
  double[][] data=dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
  int[] label=dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
  RDA qda=new RDA(data,label,alpha);
  for (int i=0; i < label.length; i++) {
    label[i]=qda.predict(data[i]);
  }
  double trainError=error(label,label);
  System.out.format("String_Node_Str",100 * trainError);
  double[][] z=new double[y.length][x.length];
  for (int i=0; i < y.length; i++) {
    for (int j=0; j < x.length; j++) {
      double[] p={x[j],y[i]};
      z[i][j]=qda.predict(p);
    }
  }
  return z;
}

Fixed version (ground truth):
@Override public double[][] learn(double[] x,double[] y){
  try {
    alpha=Double.parseDouble(alphaField.getText().trim());
    if (alpha < 0 || alpha > 1) {
      JOptionPane.showMessageDialog(this,"String_Node_Str" + alpha,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return null;
    }
  }
 catch (  Exception ex) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + alphaField.getText(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    return null;
  }
  double[][] data=dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
  int[] label=dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
  RDA qda=new RDA(data,label,alpha);
  int[] pred=new int[label.length];
  for (int i=0; i < label.length; i++) {
    pred[i]=qda.predict(data[i]);
  }
  double trainError=error(label,pred);
  System.out.format("String_Node_Str",100 * trainError);
  double[][] z=new double[y.length][x.length];
  for (int i=0; i < y.length; i++) {
    for (int j=0; j < x.length; j++) {
      double[] p={x[j],y[i]};
      z[i][j]=qda.predict(p);
    }
  }
  return z;
}
Program: 92549
Project: 92549
Buggy source:
@Override public double[][] learn(double[] x,double[] y){
  try {
    gamma=Double.parseDouble(gammaField.getText().trim());
    if (gamma <= 0) {
      JOptionPane.showMessageDialog(this,"String_Node_Str" + gamma,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return null;
    }
  }
 catch (  Exception ex) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + gammaField.getText(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    return null;
  }
  try {
    C=Double.parseDouble(cField.getText().trim());
    if (C < 0) {
      JOptionPane.showMessageDialog(this,"String_Node_Str" + C,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return null;
    }
  }
 catch (  Exception ex) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + cField.getText(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    return null;
  }
  double[][] data=dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
  int[] label=dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
  SVM<double[]> svm=new SVM<>(new GaussianKernel(gamma),C);
  svm.learn(data,label);
  svm.finish();
  for (int i=0; i < label.length; i++) {
    label[i]=svm.predict(data[i]);
  }
  double trainError=error(label,label);
  System.out.format("String_Node_Str",100 * trainError);
  double[][] z=new double[y.length][x.length];
  for (int i=0; i < y.length; i++) {
    for (int j=0; j < x.length; j++) {
      double[] p={x[j],y[i]};
      z[i][j]=svm.predict(p);
    }
  }
  return z;
}

Fixed version (ground truth):
@Override public double[][] learn(double[] x,double[] y){
  try {
    gamma=Double.parseDouble(gammaField.getText().trim());
    if (gamma <= 0) {
      JOptionPane.showMessageDialog(this,"String_Node_Str" + gamma,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return null;
    }
  }
 catch (  Exception ex) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + gammaField.getText(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    return null;
  }
  try {
    C=Double.parseDouble(cField.getText().trim());
    if (C < 0) {
      JOptionPane.showMessageDialog(this,"String_Node_Str" + C,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return null;
    }
  }
 catch (  Exception ex) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + cField.getText(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    return null;
  }
  double[][] data=dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
  int[] label=dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
  SVM<double[]> svm=new SVM<>(new GaussianKernel(gamma),C);
  svm.learn(data,label);
  svm.finish();
  int[] pred=new int[label.length];
  for (int i=0; i < label.length; i++) {
    pred[i]=svm.predict(data[i]);
  }
  double trainError=error(label,pred);
  System.out.format("String_Node_Str",100 * trainError);
  double[][] z=new double[y.length][x.length];
  for (int i=0; i < y.length; i++) {
    for (int j=0; j < x.length; j++) {
      double[] p={x[j],y[i]};
      z[i][j]=svm.predict(p);
    }
  }
  return z;
}