nus-yam/ex-repair huggingface dataset:
Program: 79814
Project: 79814
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
  if (action.equals(ACTION_DISMISS_NOTIFICATION)) {
    String packageName=intent.getStringExtra(EXTRA_PACKAGE_NAME);
    String tag=intent.getStringExtra(EXTRA_NOTIFICATION_TAG);
    int id=intent.getIntExtra(EXTRA_NOTIFICATION_ID,INVAID_ID);
    cancelNotification(packageName,tag,id);
  }
 else   if (action.equals(ACTION_PREFERENCE_CHANGED)) {
    String changedKey=intent.getStringExtra(PreferenceKeys.INTENT_ACTION_KEY);
    String newValue=intent.getStringExtra(PreferenceKeys.INTENT_ACTION_NEW_VALUE);
    if (changedKey.equals(PreferenceKeys.PREF_PEEK_TIMEOUT)) {
      mPeekTimeoutMultiplier=Integer.parseInt(newValue);
    }
 else     if (changedKey.equals(PreferenceKeys.PREF_SENSOR_TIMEOUT)) {
      mSensorTimeoutMultiplier=Integer.parseInt(newValue);
    }
 else     if (changedKey.equals(PreferenceKeys.PREF_ALWAYS_SHOW_CONTENT)) {
      mShowContent=Boolean.parseBoolean(newValue);
    }
 else     if (changedKey.equals(PreferenceKeys.PREF_BACKGROUND) || changedKey.equals(PreferenceKeys.PREF_DIM) || changedKey.equals(PreferenceKeys.PREF_RADIUS)) {
      mNotificationPeek.updateBackgroundImageView();
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
  if (action.equals(ACTION_DISMISS_NOTIFICATION)) {
    String packageName=intent.getStringExtra(EXTRA_PACKAGE_NAME);
    String tag=intent.getStringExtra(EXTRA_NOTIFICATION_TAG);
    int id=intent.getIntExtra(EXTRA_NOTIFICATION_ID,INVAID_ID);
    cancelNotification(packageName,tag,id);
  }
 else   if (action.equals(ACTION_PREFERENCE_CHANGED)) {
    String changedKey=intent.getStringExtra(PreferenceKeys.INTENT_ACTION_KEY);
    String newValue=intent.getStringExtra(PreferenceKeys.INTENT_ACTION_NEW_VALUE);
    if (changedKey.equals(PreferenceKeys.PREF_PEEK_TIMEOUT)) {
      mPeekTimeoutMultiplier=Integer.parseInt(newValue);
    }
 else     if (changedKey.equals(PreferenceKeys.PREF_SENSOR_TIMEOUT)) {
      mSensorTimeoutMultiplier=Integer.parseInt(newValue);
    }
 else     if (changedKey.equals(PreferenceKeys.PREF_ALWAYS_SHOW_CONTENT)) {
      mShowContent=Boolean.parseBoolean(newValue);
    }
 else     if (changedKey.equals(PreferenceKeys.PREF_BACKGROUND) || changedKey.equals(PreferenceKeys.PREF_DIM) || changedKey.equals(PreferenceKeys.PREF_RADIUS)) {
      mNotificationPeek.updateBackgroundImageView();
    }
  }
 else   if (action.equals(Intent.ACTION_WALLPAPER_CHANGED)) {
    mNotificationPeek.updateBackgroundImageView();
  }
}
Program: 79816
Project: 79816
Buggy source:
/** 
 * Update background ImageView to display proper background according to user preference.
 */
public void updateBackgroundImageView(){
  boolean used=WallpaperFactory.isWallpaperThemeSelected(mContext);
  if (mPeekBackgroundImageView == null) {
    mPeekBackgroundImageView=new ImageView(mContext);
    ViewGroup.LayoutParams params=new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
    mPeekBackgroundImageView.setLayoutParams(params);
    mPeekBackgroundImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
  }
  if (used) {
    mPeekBackgroundImageView.setImageBitmap(WallpaperFactory.getPrefSystemWallpaper(mContext));
    if (!isBackgroundImageViewAdded()) {
      sPeekView.addView(mPeekBackgroundImageView,0);
    }
  }
 else {
    if (isBackgroundImageViewAdded()) {
      sPeekView.removeViewAt(0);
    }
  }
}

Fixed version (ground truth):
/** 
 * Update background ImageView to display proper background according to user preference.
 */
public void updateBackgroundImageView(){
  boolean used=mWallpaperFactory.isWallpaperThemeSelected();
  if (mPeekBackgroundImageView == null) {
    mPeekBackgroundImageView=new ImageView(mContext);
    ViewGroup.LayoutParams params=new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
    mPeekBackgroundImageView.setLayoutParams(params);
    mPeekBackgroundImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
  }
  if (used) {
    mPeekBackgroundImageView.setImageBitmap(mWallpaperFactory.getPrefSystemWallpaper());
    if (!isBackgroundImageViewAdded()) {
      sPeekView.addView(mPeekBackgroundImageView,0);
    }
  }
 else {
    if (isBackgroundImageViewAdded()) {
      sPeekView.removeViewAt(0);
    }
  }
}
Program: 79817
Project: 79817
Buggy source:
@Override public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  if (mNothingSelected) {
    mNothingSelected=false;
    return;
  }
  SharedPreferences pref=PreferenceManager.getDefaultSharedPreferences(getActivity());
  if (position == 0) {
    pref.edit().putInt(PreferenceKeys.PREF_BACKGROUND,WallpaperFactory.BACKGROUND_PURE_BLACK).apply();
  }
 else {
    pref.edit().putInt(PreferenceKeys.PREF_BACKGROUND,WallpaperFactory.BACKGROUND_SYSTEM_WALLPAPER).apply();
  }
  mHandler.postDelayed(mChangePreviewRunnable,300);
  Intent intent=new Intent(NotificationService.ACTION_PREFERENCE_CHANGED);
  intent.putExtra(PreferenceKeys.INTENT_ACTION_KEY,PreferenceKeys.PREF_BACKGROUND);
  getActivity().sendBroadcast(intent);
}

Fixed version (ground truth):
@Override public void onItemSelected(AdapterView<?> parent,View view,int position,long id){
  if (mNothingSelected) {
    mNothingSelected=false;
    return;
  }
  SharedPreferences pref=PreferenceManager.getDefaultSharedPreferences(getActivity());
  if (position == 0) {
    pref.edit().putInt(PreferenceKeys.PREF_BACKGROUND,WallpaperFactory.BACKGROUND_PURE_BLACK).apply();
  }
 else {
    pref.edit().putInt(PreferenceKeys.PREF_BACKGROUND,WallpaperFactory.BACKGROUND_SYSTEM_WALLPAPER).apply();
  }
  mHandler.postDelayed(mChangePreviewRunnable,300);
}
Program: 79818
Project: 79818
Buggy source:
/** 
 * Create a new   {@link android.graphics.drawable.TransitionDrawable} object with correct orderof Drawables based on user selection.
 * @return  TransitionDrawable object created.
 */
private TransitionDrawable initPreviewBackgroundDrawable(){
  Drawable[] drawables;
  boolean isWallpaperSelected=WallpaperFactory.isWallpaperThemeSelected(getActivity());
  Drawable black=new ColorDrawable(Color.BLACK);
  Drawable wallpaper=new BitmapDrawable(getResources(),WallpaperFactory.getPrefSystemWallpaper(getActivity()));
  drawables=!isWallpaperSelected ? new Drawable[]{black,wallpaper} : new Drawable[]{wallpaper,black};
  return new TransitionDrawable(drawables);
}

Fixed version (ground truth):
/** 
 * Create a new   {@link android.graphics.drawable.TransitionDrawable} object with correct orderof Drawables based on user selection.
 * @return TransitionDrawable object created.
 */
private TransitionDrawable initPreviewBackgroundDrawable(){
  Drawable[] drawables;
  boolean isWallpaperSelected=mWallpaperFactory.isWallpaperThemeSelected();
  Drawable black=new ColorDrawable(Color.BLACK);
  Drawable wallpaper=new BitmapDrawable(getResources(),mWallpaperFactory.getPrefSystemWallpaper());
  drawables=!isWallpaperSelected ? new Drawable[]{black,wallpaper} : new Drawable[]{wallpaper,black};
  return new TransitionDrawable(drawables);
}
Program: 79819
Project: 79819
Buggy source:
/** 
 * Seek Drawable index within TransitionDrawable object. We need to find the index of the drawable that is different from the parameter, which is the starting drawable of the TransitionDrawable.
 * @param T target drawable class.
 * @return  Index of the source drawable.
 */
private int getSourceDrawableIndex(Class T){
  if (mPreviewImageDrawable.getDrawable(0).getClass().equals(T) && mPreviewImageDrawable.getDrawable(1).getClass().equals(T)) {
    return 1;
  }
  return mPreviewImageDrawable.getDrawable(0).getClass().equals(T) ? 1 : 0;
}

Fixed version (ground truth):
/** 
 * Seek Drawable index within TransitionDrawable object. We need to find the index of the drawable that is different from the parameter, which is the starting drawable of the TransitionDrawable.
 * @param T target drawable class.
 * @return Index of the source drawable.
 */
private int getSourceDrawableIndex(Class T){
  if (mPreviewImageDrawable.getDrawable(0).getClass().equals(mPreviewImageDrawable.getDrawable(1).getClass())) {
    return 1;
  }
  return mPreviewImageDrawable.getDrawable(0).getClass().equals(T) ? 1 : 0;
}
Program: 79820
Project: 79820
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  mHandler=new Handler(Looper.getMainLooper());
  mPreviewImageDrawable=initPreviewBackgroundDrawable();
  View rootView=inflater.inflate(R.layout.appearance_fragment_layout,container,false);
  mBackgroundSpinner=(Spinner)rootView.findViewById(R.id.spinner);
  ArrayAdapter<String> spinnerAdapter=new ArrayAdapter<String>(getActivity(),R.layout.spinner_item_layout,R.id.text_view,getResources().getStringArray(R.array.background_pref_array));
  mBackgroundSpinner.setAdapter(spinnerAdapter);
  mBackgroundSpinner.setOnItemSelectedListener(this);
  mPreviewImageView=(ImageView)rootView.findViewById(R.id.preview_image_view);
  mPreviewImageView.setImageDrawable(mPreviewImageDrawable);
  mRadiusSeek=(SeekBar)rootView.findViewById(R.id.radius_seek);
  mDimSeek=(SeekBar)rootView.findViewById(R.id.dim_seek);
  mRadiusText=(TextView)rootView.findViewById(R.id.radius_text);
  mDimText=(TextView)rootView.findViewById(R.id.dim_text);
  initSeekBars();
  updateLayouts(false);
  return rootView;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  mHandler=new Handler(Looper.getMainLooper());
  mWallpaperFactory=new WallpaperFactory(getActivity());
  mPreviewImageDrawable=initPreviewBackgroundDrawable();
  View rootView=inflater.inflate(R.layout.appearance_fragment_layout,container,false);
  mBackgroundSpinner=(Spinner)rootView.findViewById(R.id.spinner);
  ArrayAdapter<String> spinnerAdapter=new ArrayAdapter<String>(getActivity(),R.layout.spinner_item_layout,R.id.text_view,getResources().getStringArray(R.array.background_pref_array));
  mBackgroundSpinner.setAdapter(spinnerAdapter);
  mBackgroundSpinner.setOnItemSelectedListener(this);
  mPreviewImageView=(ImageView)rootView.findViewById(R.id.preview_image_view);
  mPreviewImageView.setImageDrawable(mPreviewImageDrawable);
  mRadiusSeek=(SeekBar)rootView.findViewById(R.id.radius_seek);
  mDimSeek=(SeekBar)rootView.findViewById(R.id.dim_seek);
  mRadiusText=(TextView)rootView.findViewById(R.id.radius_text);
  mDimText=(TextView)rootView.findViewById(R.id.dim_text);
  initSeekBars();
  updateLayouts(false);
  return rootView;
}
Program: 79821
Project: 79821
Buggy source:
/** 
 * Update layout components (SeekBar, TextView, ImageView) according to the new preference.
 * @param manual    If the update is from user or from the initialization.
 */
private void updateLayouts(boolean manual){
  if (!WallpaperFactory.isWallpaperThemeSelected(getActivity())) {
    if (!manual) {
      mBackgroundSpinner.setSelection(0);
    }
 else {
      mPreviewImageDrawable.reverseTransition(TRANSITION_ANIM_DURATION);
    }
    mRadiusSeek.setEnabled(false);
    mDimSeek.setEnabled(false);
    mRadiusText.setEnabled(false);
    mDimText.setEnabled(false);
  }
 else {
    if (!manual) {
      mBackgroundSpinner.setSelection(1);
    }
 else {
      mPreviewImageDrawable.reverseTransition(TRANSITION_ANIM_DURATION);
    }
    mRadiusSeek.setEnabled(true);
    mDimSeek.setEnabled(true);
    mRadiusText.setEnabled(true);
    mDimText.setEnabled(true);
  }
}

Fixed version (ground truth):
/** 
 * Update layout components (SeekBar, TextView, ImageView) according to the new preference.
 * @param manual If the update is from user or from the initialization.
 */
private void updateLayouts(boolean manual){
  if (!mWallpaperFactory.isWallpaperThemeSelected()) {
    if (!manual) {
      mBackgroundSpinner.setSelection(0);
    }
 else {
      mPreviewImageDrawable.reverseTransition(TRANSITION_ANIM_DURATION);
    }
    mRadiusSeek.setEnabled(false);
    mDimSeek.setEnabled(false);
    mRadiusText.setEnabled(false);
    mDimText.setEnabled(false);
  }
 else {
    if (!manual) {
      mBackgroundSpinner.setSelection(1);
    }
 else {
      mPreviewImageDrawable.reverseTransition(TRANSITION_ANIM_DURATION);
    }
    mRadiusSeek.setEnabled(true);
    mDimSeek.setEnabled(true);
    mRadiusText.setEnabled(true);
    mDimText.setEnabled(true);
  }
}
Program: 79822
Project: 79822
Buggy source:
@Override public void run(){
  Drawable[] previewDrawables=new Drawable[2];
  previewDrawables[1]=WallpaperFactory.isWallpaperThemeSelected(getActivity()) ? new BitmapDrawable(getResources(),WallpaperFactory.getPrefSystemWallpaper(getActivity())) : new ColorDrawable(Color.BLACK);
  previewDrawables[0]=mPreviewImageDrawable.getDrawable(getSourceDrawableIndex(previewDrawables[1].getClass()));
  mPreviewImageDrawable=new TransitionDrawable(previewDrawables);
  mPreviewImageView.setImageDrawable(mPreviewImageDrawable);
  updateLayouts(true);
}

Fixed version (ground truth):
@Override public void run(){
  Drawable[] previewDrawables=new Drawable[2];
  previewDrawables[1]=mWallpaperFactory.isWallpaperThemeSelected() ? new BitmapDrawable(getResources(),mWallpaperFactory.getPrefSystemWallpaper()) : new ColorDrawable(Color.BLACK);
  previewDrawables[0]=mPreviewImageDrawable.getDrawable(getSourceDrawableIndex(previewDrawables[1].getClass()));
  mPreviewImageDrawable=new TransitionDrawable(previewDrawables);
  mPreviewImageView.setImageDrawable(mPreviewImageDrawable);
  updateLayouts(true);
}
Program: 79823
Project: 79823
Buggy source:
private void initSeekBars(){
  mRadiusSeek.setMax(ImageBlurrer.MAX_SUPPORTED_BLUR_PIXELS * 10);
  mDimSeek.setMax(WallpaperFactory.DEFAULT_MAX_DIM);
  SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(getActivity());
  int radius=(int)(preferences.getFloat(PreferenceKeys.PREF_RADIUS,ImageBlurrer.MAX_SUPPORTED_BLUR_PIXELS) * 10);
  int dim=preferences.getInt(PreferenceKeys.PREF_DIM,WallpaperFactory.DEFAULT_MAX_DIM);
  mRadiusSeek.setProgress(radius);
  mDimSeek.setProgress(dim);
  mRadiusSeek.setOnSeekBarChangeListener(this);
  mDimSeek.setOnSeekBarChangeListener(this);
}

Fixed version (ground truth):
private void initSeekBars(){
  mRadiusSeek.setMax(ImageBlurrer.MAX_SUPPORTED_BLUR_PIXELS * 10);
  mDimSeek.setMax(WallpaperFactory.DEFAULT_MAX_DIM);
  SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(getActivity());
  int radius=(int)(preferences.getFloat(PreferenceKeys.PREF_RADIUS,ImageBlurrer.MAX_SUPPORTED_BLUR_PIXELS) * 10);
  int dim=preferences.getInt(PreferenceKeys.PREF_DIM,WallpaperFactory.DEFAULT_MAX_DIM);
  mRadiusSeek.setProgress(radius);
  mDimSeek.setProgress(255 - dim);
  mRadiusSeek.setOnSeekBarChangeListener(this);
  mDimSeek.setOnSeekBarChangeListener(this);
}
Program: 79824
Project: 79824
Buggy source:
@Override public void onStopTrackingTouch(SeekBar seekBar){
  mHandler.postDelayed(mReloadPreviewRunnable,300);
  Intent intent=new Intent(NotificationService.ACTION_PREFERENCE_CHANGED);
  String intentActionKey=seekBar.getId() == R.id.radius_seek ? PreferenceKeys.PREF_RADIUS : PreferenceKeys.PREF_DIM;
  intent.putExtra(PreferenceKeys.INTENT_ACTION_KEY,intentActionKey);
  getActivity().sendBroadcast(intent);
}

Fixed version (ground truth):
@Override public void onStopTrackingTouch(SeekBar seekBar){
  mHandler.postDelayed(mReloadPreviewRunnable,300);
}
Program: 79825
Project: 79825
Buggy source:
/** 
 * Create a bitmap that is blurred and dimmed with the amount that user has selected.
 * @param context   Context object.
 * @return          Background bitmap.
 */
public static Bitmap getPrefSystemWallpaper(Context context){
  SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(context);
  float radius=preferences.getFloat(PreferenceKeys.PREF_RADIUS,ImageBlurrer.MAX_SUPPORTED_BLUR_PIXELS);
  int dim=preferences.getInt(PreferenceKeys.PREF_DIM,DEFAULT_MAX_DIM);
  WallpaperManager wallpaperManager=WallpaperManager.getInstance(context);
  ImageBlurrer imageBlurrer=new ImageBlurrer(context);
  Bitmap blurred=imageBlurrer.blurBitmap(drawableToBitmap(wallpaperManager.getFastDrawable()),radius);
  Canvas c=new Canvas(blurred);
  c.drawColor(Color.argb(255 - dim,0,0,0));
  return blurred;
}

Fixed version (ground truth):
/** 
 * Create a bitmap that is blurred and dimmed with the amount that user has selected.
 * @return          Background bitmap.
 */
public Bitmap getPrefSystemWallpaper(){
  SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(mContext);
  float radius=preferences.getFloat(PreferenceKeys.PREF_RADIUS,ImageBlurrer.MAX_SUPPORTED_BLUR_PIXELS);
  int dim=preferences.getInt(PreferenceKeys.PREF_DIM,DEFAULT_MAX_DIM);
  ImageBlurrer imageBlurrer=new ImageBlurrer(mContext);
  Bitmap blurred=imageBlurrer.blurBitmap(drawableToBitmap(mWallpaperManager.getFastDrawable()),radius);
  Canvas c=new Canvas(blurred);
  c.drawColor(Color.argb(255 - dim,0,0,0));
  return blurred;
}
Program: 79826
Project: 79826
Buggy source:
/** 
 * Convert drawable to bitmap.
 * @param drawable      Drawable object to be converted.
 * @return              converted bitmap.
 */
private static Bitmap drawableToBitmap(Drawable drawable){
  if (drawable instanceof BitmapDrawable) {
    return ((BitmapDrawable)drawable).getBitmap();
  }
  Bitmap bitmap=Bitmap.createBitmap(drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight(),Bitmap.Config.ARGB_8888);
  Canvas canvas=new Canvas(bitmap);
  drawable.setBounds(0,0,canvas.getWidth(),canvas.getHeight());
  drawable.draw(canvas);
  return bitmap;
}

Fixed version (ground truth):
/** 
 * Convert drawable to bitmap.
 * @param drawable      Drawable object to be converted.
 * @return              converted bitmap.
 */
private Bitmap drawableToBitmap(Drawable drawable){
  if (drawable instanceof BitmapDrawable) {
    return ((BitmapDrawable)drawable).getBitmap();
  }
  Bitmap bitmap=Bitmap.createBitmap(drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight(),Bitmap.Config.ARGB_8888);
  Canvas canvas=new Canvas(bitmap);
  drawable.setBounds(0,0,canvas.getWidth(),canvas.getHeight());
  drawable.draw(canvas);
  return bitmap;
}
Program: 79827
Project: 79827
Buggy source:
/** 
 * Check if user selected system wallpaper as Peek background.
 * @param context   Context object.
 * @return          True if system wallpaper is selected, false otherwise.
 */
public static boolean isWallpaperThemeSelected(Context context){
  return PreferenceManager.getDefaultSharedPreferences(context).getInt(PreferenceKeys.PREF_BACKGROUND,BACKGROUND_PURE_BLACK) == BACKGROUND_SYSTEM_WALLPAPER;
}

Fixed version (ground truth):
/** 
 * Check if user selected system wallpaper as Peek background.
 * @return          True if system wallpaper is selected, false otherwise.
 */
public boolean isWallpaperThemeSelected(){
  return PreferenceManager.getDefaultSharedPreferences(mContext).getInt(PreferenceKeys.PREF_BACKGROUND,BACKGROUND_PURE_BLACK) == BACKGROUND_SYSTEM_WALLPAPER;
}
Program: 79828
Project: 79828
Buggy source:
/** 
 * Update small notification icons when there is new notification coming, and the Activity is in foreground.
 */
private void updateNotificationIcons(){
  if (mNotificationsContainer.getVisibility() != View.VISIBLE) {
    mNotificationsContainer.setVisibility(View.VISIBLE);
  }
  NotificationHub notificationHub=mPeek.getNotificationHub();
  int iconSize=getResources().getDimensionPixelSize(R.dimen.small_notification_icon_size);
  int padding=getResources().getDimensionPixelSize(R.dimen.small_notification_icon_padding);
  final StatusBarNotification n=notificationHub.getCurrentNotification();
  ImageView icon=new ImageView(this);
  icon.setAlpha(NotificationPeek.ICON_LOW_OPACITY);
  icon.setPadding(padding,0,padding,0);
  icon.setImageDrawable(NotificationPeekViewUtils.getIconFromResource(this,n));
  icon.setTag(n);
  int oldIndex=getOldIconViewIndex(notificationHub);
  if (oldIndex >= 0) {
    mNotificationsContainer.removeViewAt(oldIndex);
  }
  mNotificationsContainer.addView(icon);
  LinearLayout.LayoutParams linearLayoutParams=new LinearLayout.LayoutParams(iconSize,iconSize);
  GridLayout.LayoutParams gridLayoutParams=new GridLayout.LayoutParams(linearLayoutParams);
  icon.setLayoutParams(gridLayoutParams);
}

Fixed version (ground truth):
/** 
 * Update small notification icons when there is new notification coming, and the Activity is in foreground.
 */
private void updateNotificationIcons(){
  if (mNotificationsContainer.getVisibility() != View.VISIBLE) {
    mNotificationsContainer.setVisibility(View.VISIBLE);
  }
  NotificationHub notificationHub=NotificationHub.getInstance();
  int iconSize=getResources().getDimensionPixelSize(R.dimen.small_notification_icon_size);
  int padding=getResources().getDimensionPixelSize(R.dimen.small_notification_icon_padding);
  final StatusBarNotification n=notificationHub.getCurrentNotification();
  ImageView icon=new ImageView(this);
  icon.setAlpha(NotificationPeek.ICON_LOW_OPACITY);
  icon.setPadding(padding,0,padding,0);
  icon.setImageDrawable(NotificationPeekViewUtils.getIconFromResource(this,n));
  icon.setTag(n);
  restoreFirstIconVisibility();
  int oldIndex=getOldIconViewIndex(notificationHub);
  if (oldIndex >= 0) {
    mNotificationsContainer.removeViewAt(oldIndex);
  }
  mNotificationsContainer.addView(icon);
  LinearLayout.LayoutParams linearLayoutParams=new LinearLayout.LayoutParams(iconSize,iconSize);
  GridLayout.LayoutParams gridLayoutParams=new GridLayout.LayoutParams(linearLayoutParams);
  icon.setLayoutParams(gridLayoutParams);
}
Program: 79829
Project: 79829
Buggy source:
/** 
 * Check whether a notification with the same package name as the new notification is shown in the icon container.
 * @param hub   NotificationHub instance.
 * @return      Index of the icon ImageView in its parent. -1 if not found.
 */
private int getOldIconViewIndex(NotificationHub hub){
  for (int i=0; i < mNotificationsContainer.getChildCount(); i++) {
    View child=mNotificationsContainer.getChildAt(i);
    if (child.getTag() == null) {
      continue;
    }
    StatusBarNotification n=(StatusBarNotification)child.getTag();
    if (n.getPackageName().equals(hub.getCurrentNotification().getPackageName())) {
      return i;
    }
  }
  return -1;
}

Fixed version (ground truth):
/** 
 * Check whether a notification with the same package name as the new notification is shown in the icon container.
 * @param hub NotificationHub instance.
 * @return Index of the icon ImageView in its parent. -1 if not found.
 */
private int getOldIconViewIndex(NotificationHub hub){
  for (int i=0; i < mNotificationsContainer.getChildCount(); i++) {
    View child=mNotificationsContainer.getChildAt(i);
    if (child.getTag() == null) {
      continue;
    }
    StatusBarNotification n=(StatusBarNotification)child.getTag();
    if (n.getPackageName().equals(hub.getCurrentNotification().getPackageName())) {
      return i;
    }
  }
  return -1;
}
Program: 79831
Project: 79831
Buggy source:
private void updateSelection(StatusBarNotification n){
  if (mShowing) {
    return;
  }
  String oldNotif=PanelHelper.getContentDescription((StatusBarNotification)mNotificationView.getTag());
  String newNotif=PanelHelper.getContentDescription(n);
  boolean sameNotification=newNotif.equals(oldNotif);
  if (!mAnimating || sameNotification) {
    Bitmap b=n.getNotification().largeIcon;
    if (b != null) {
      mNotificationIcon.setImageBitmap(getRoundedShape(b));
    }
 else {
      mNotificationIcon.setImageDrawable(getIconFromResource(n));
    }
    final PendingIntent contentIntent=n.getNotification().contentIntent;
    if (contentIntent != null) {
      final View.OnClickListener listener=new NotificationClicker(contentIntent,n);
      mNotificationIcon.setOnClickListener(listener);
    }
 else {
      mNotificationIcon.setOnClickListener(null);
    }
    mNotificationText.setText(getNotificationDisplayText(n));
    mNotificationText.setVisibility(isKeyguardSecureShowing() ? View.GONE : View.VISIBLE);
    mNotificationView.setTag(n);
    if (!sameNotification) {
      mNotificationView.setAlpha(1f);
      mNotificationView.setX(0);
    }
  }
  for (int i=0; i < mNotificationsContainer.getChildCount(); i++) {
    ImageView view=(ImageView)mNotificationsContainer.getChildAt(i);
    if ((mAnimating ? oldNotif : newNotif).equals(PanelHelper.getContentDescription((StatusBarNotification)view.getTag()))) {
      view.setAlpha(1f);
    }
 else {
      view.setAlpha(ICON_LOW_OPACITY);
    }
  }
}

Fixed version (ground truth):
private void updateSelection(StatusBarNotification n){
  String oldNotif=PanelHelper.getContentDescription((StatusBarNotification)mNotificationView.getTag());
  String newNotif=PanelHelper.getContentDescription(n);
  boolean sameNotification=newNotif.equals(oldNotif);
  if (!mAnimating || sameNotification) {
    Bitmap b=n.getNotification().largeIcon;
    if (b != null) {
      mNotificationIcon.setImageBitmap(getRoundedShape(b));
    }
 else {
      mNotificationIcon.setImageDrawable(getIconFromResource(n));
    }
    final PendingIntent contentIntent=n.getNotification().contentIntent;
    if (contentIntent != null) {
      final View.OnClickListener listener=new NotificationClicker(contentIntent,n);
      mNotificationIcon.setOnClickListener(listener);
    }
 else {
      mNotificationIcon.setOnClickListener(null);
    }
    mNotificationText.setText(getNotificationDisplayText(n));
    mNotificationText.setVisibility(isKeyguardSecureShowing() ? View.GONE : View.VISIBLE);
    mNotificationView.setTag(n);
    if (!sameNotification) {
      mNotificationView.setAlpha(1f);
      mNotificationView.setX(0);
    }
  }
  for (int i=0; i < mNotificationsContainer.getChildCount(); i++) {
    ImageView view=(ImageView)mNotificationsContainer.getChildAt(i);
    if ((mAnimating ? oldNotif : newNotif).equals(PanelHelper.getContentDescription((StatusBarNotification)view.getTag()))) {
      view.setAlpha(1f);
    }
 else {
      view.setAlpha(ICON_LOW_OPACITY);
    }
  }
}
Program: 79833
Project: 79833
Buggy source:
private void createSocialSample(Project project,String apiUrl,String methodType,String name,String description,List<UrlParamDTO> urlParams,JSONObject jsonObject){
  String projectId=project.getId();
  String projectRefId=project.getProjectRef().getId();
  ConversationDTO socialDTO=new ConversationDTO();
  socialDTO.setWorkspaceId(socialWorkspaceId);
  RfRequestDTO socialReqDTO=new RfRequestDTO();
  socialReqDTO.setApiUrl(apiUrl);
  socialReqDTO.setMethodType(methodType);
  socialDTO.setRfRequestDTO(socialReqDTO);
  if (urlParams != null) {
    socialReqDTO.setUrlParams(urlParams);
  }
  if (jsonObject != null) {
    socialReqDTO.setApiBody(jsonObject.toString(4));
  }
  ConversationDTO conversationsocial=conversationController.create(socialDTO);
  NodeDTO socialNode=new NodeDTO();
  socialNode.setName(name);
  socialNode.setDescription(description);
  socialNode.setProjectId(projectId);
  socialNode.setConversationDTO(conversationsocial);
  NodeDTO createdSocialNode=nodeController.create(projectRefId,socialNode);
  conversationsocial.setNodeDTO(createdSocialNode);
  conversationController.update(conversationsocial.getId(),conversationsocial);
}

Fixed version (ground truth):
private void createSocialSample(Project project,String apiUrl,String methodType,String name,String description,List<UrlParamDTO> urlParams,JSONObject jsonObject){
  String projectId=project.getId();
  String projectRefId=project.getProjectRef().getId();
  ConversationDTO socialDTO=new ConversationDTO();
  socialDTO.setWorkspaceId(socialWorkspaceId);
  RfRequestDTO socialReqDTO=new RfRequestDTO();
  socialReqDTO.setApiUrl(apiUrl);
  socialReqDTO.setMethodType(methodType);
  socialDTO.setRfRequestDTO(socialReqDTO);
  if (urlParams != null) {
    socialReqDTO.setUrlParams(urlParams);
  }
  if (jsonObject != null) {
    socialReqDTO.setApiBody(jsonObject.toString(4));
  }
  ConversationDTO conversationsocial=conversationController.create(socialDTO);
  NodeDTO socialNode=new NodeDTO();
  socialNode.setName(name);
  socialNode.setDescription(description);
  socialNode.setProjectId(projectId);
  socialNode.setConversationDTO(conversationsocial);
  socialNode.setWorkspaceId(socialWorkspaceId);
  NodeDTO createdSocialNode=nodeController.create(projectRefId,socialNode);
  conversationsocial.setNodeDTO(createdSocialNode);
  conversationController.update(conversationsocial.getId(),conversationsocial);
}
Program: 79836
Project: 79836
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public @ResponseBody Assertion findAsserts(@PathVariable("String_Node_Str") String requestId){
  RfRequest rfRequest=rfRequestRepository.findOne(requestId);
  if (rfRequest == null) {
    return null;
  }
  Assertion assertion=rfRequest.getAssertion();
  return assertion;
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public @ResponseBody Assertion findAsserts(@PathVariable("String_Node_Str") String nodeId){
  BaseNode node=nodeRepository.findOne(nodeId);
  if (node == null || node.getConversation() == null) {
    return null;
  }
  RfRequest rfRequest=node.getConversation().getRfRequest();
  if (rfRequest == null) {
    return null;
  }
  Assertion assertion=rfRequest.getAssertion();
  return assertion;
}
Program: 79837
Project: 79837
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,headers="String_Node_Str") public @ResponseBody Assertion save(@PathVariable("String_Node_Str") String requestId,@RequestBody AssertionDTO assertionDTO){
  RfRequest rfRequest=rfRequestRepository.findOne(requestId);
  if (rfRequest == null) {
    return null;
  }
  Assertion assertion=new Assertion();
  List<BodyAssertDTO> bodyAssertDTOs=assertionDTO.getBodyAssertDTOs();
  if (bodyAssertDTOs != null && !bodyAssertDTOs.isEmpty()) {
    List<BodyAssert> bodyAsserts=new ArrayList<BodyAssert>();
    BodyAssert bodyAssert=null;
    for (    BodyAssertDTO bodyAssertDTO : bodyAssertDTOs) {
      bodyAssert=new BodyAssert();
      bodyAssert.setPropertyName(bodyAssertDTO.getPropertyName());
      bodyAssert.setComparator(bodyAssertDTO.getComparator());
      bodyAssert.setExpectedValue(bodyAssertDTO.getExpectedValue());
      bodyAsserts.add(bodyAssert);
    }
    assertion.setBodyAsserts(bodyAsserts);
    rfRequest.setAssertion(assertion);
  }
  assertion=assertionRepository.save(assertion);
  RfRequest savedRFRequest=rfRequestRepository.save(rfRequest);
  return savedRFRequest.getAssertion();
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,headers="String_Node_Str") public @ResponseBody Assertion save(@PathVariable("String_Node_Str") String nodeId,@RequestBody AssertionDTO assertionDTO){
  BaseNode node=nodeRepository.findOne(nodeId);
  if (node == null || node.getConversation() == null) {
    return null;
  }
  RfRequest rfRequest=node.getConversation().getRfRequest();
  if (rfRequest == null) {
    return null;
  }
  Assertion assertion=new Assertion();
  List<BodyAssertDTO> bodyAssertDTOs=assertionDTO.getBodyAssertDTOs();
  if (bodyAssertDTOs != null && !bodyAssertDTOs.isEmpty()) {
    List<BodyAssert> bodyAsserts=new ArrayList<BodyAssert>();
    BodyAssert bodyAssert=null;
    for (    BodyAssertDTO bodyAssertDTO : bodyAssertDTOs) {
      bodyAssert=new BodyAssert();
      bodyAssert.setPropertyName(bodyAssertDTO.getPropertyName());
      bodyAssert.setComparator(bodyAssertDTO.getComparator());
      bodyAssert.setExpectedValue(bodyAssertDTO.getExpectedValue());
      bodyAsserts.add(bodyAssert);
    }
    assertion.setBodyAsserts(bodyAsserts);
    rfRequest.setAssertion(assertion);
  }
  assertion=assertionRepository.save(assertion);
  RfRequest savedRFRequest=rfRequestRepository.save(rfRequest);
  return savedRFRequest.getAssertion();
}
Program: 79839
Project: 79839
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.PUT,headers="String_Node_Str") public @ResponseBody Environment update(@PathVariable("String_Node_Str") Long id,@RequestBody EnvironmentDTO updated){
  logger.debug("String_Node_Str" + updated);
  Environment environment=environmentRepository.findOne(updated.getId());
  environment.setName(updated.getName());
  environment.setDescription(updated.getDescription());
  List<EnvironmentPropertyDTO> propertyDTOs=updated.getProperties();
  if (propertyDTOs != null && !propertyDTOs.isEmpty()) {
    List<EnvironmentProperty> properties=new ArrayList<EnvironmentProperty>();
    EnvironmentProperty property=null;
    for (    EnvironmentPropertyDTO propertyDTO : propertyDTOs) {
      property=new EnvironmentProperty();
      property.setPropertyName(propertyDTO.getPropertyName());
      property.setPropertyValue(propertyDTO.getPropertyValue());
      properties.add(property);
    }
    environment.setProperties(properties);
  }
  environment=environmentRepository.save(environment);
  return environment;
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.PUT,headers="String_Node_Str") public @ResponseBody Environment update(@PathVariable("String_Node_Str") String id,@RequestBody EnvironmentDTO updated){
  logger.debug("String_Node_Str" + updated);
  Environment environment=environmentRepository.findOne(updated.getId());
  environment.setName(updated.getName());
  environment.setDescription(updated.getDescription());
  List<EnvironmentPropertyDTO> propertyDTOs=updated.getProperties();
  if (propertyDTOs != null && !propertyDTOs.isEmpty()) {
    List<EnvironmentProperty> properties=new ArrayList<EnvironmentProperty>();
    EnvironmentProperty property=null;
    for (    EnvironmentPropertyDTO propertyDTO : propertyDTOs) {
      property=new EnvironmentProperty();
      property.setPropertyName(propertyDTO.getPropertyName());
      property.setPropertyValue(propertyDTO.getPropertyValue());
      properties.add(property);
    }
    environment.setProperties(properties);
  }
  environment=environmentRepository.save(environment);
  return environment;
}
Program: 79840
Project: 79840
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.PUT,headers="String_Node_Str") public @ResponseBody Conversation update(@PathVariable("String_Node_Str") String conversationId,@RequestBody ConversationDTO updated){
  logger.debug("String_Node_Str" + updated);
  Conversation item=itemRepository.findOne(updated.getId());
  item.setName(updated.getName());
  item.setDescription(updated.getDescription());
  RfRequestDTO rfRequestDTO=updated.getRfRequestDTO();
  RfRequest rfRequest=item.getRfRequest();
  if (null != rfRequestDTO) {
    rfRequest.setApiUrlString(rfRequestDTO.getApiUrl());
    if (rfRequestDTO.getApiBody() != null) {
      rfRequest.setApiBody(rfRequestDTO.getApiBody().getBytes());
    }
    rfRequest.setMethodType(rfRequestDTO.getMethodType());
  }
  item.setRfRequest(rfRequest);
  return item;
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.PUT,headers="String_Node_Str") public @ResponseBody Conversation update(@PathVariable("String_Node_Str") String conversationId,@RequestBody ConversationDTO conversationDTO){
  Conversation dbConversation=itemRepository.findOne(conversationDTO.getId());
  RfRequestDTO rfRequestDTO=conversationDTO.getRfRequestDTO();
  RfResponseDTO rfResponseDTO=new RfResponseDTO();
  Conversation conversation=ConversationConverter.convertToEntity(rfRequestDTO,rfResponseDTO);
  conversation.setId(dbConversation.getId());
  conversation.setName(conversationDTO.getName());
  conversation.setDescription(conversationDTO.getDescription());
  conversation.setCreatedDate(new Date());
  conversation.setLastModifiedDate(new Date());
  RfRequest rfRequest=conversation.getRfRequest();
  RfRequest dbRfRequest=dbConversation.getRfRequest();
  if (dbRfRequest != null) {
    rfRequest.setId(dbRfRequest.getId());
  }
  rfRequest.setConversationId(conversation.getId());
  rfRequestRepository.save(rfRequest);
  RfResponse rfResponse=conversation.getRfResponse();
  RfResponse dbRfResponse=dbConversation.getRfResponse();
  if (dbRfResponse != null) {
    rfResponse.setId(dbRfResponse.getId());
  }
  rfResponseRepository.save(rfResponse);
  conversation=itemRepository.save(conversation);
  return conversation;
}
Program: 79841
Project: 79841
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public @ResponseBody List<Conversation> findAll(@RequestParam(value="String_Node_Str",required=false) Integer page,@RequestParam(value="String_Node_Str",required=false) Integer limit){
  logger.debug("String_Node_Str");
  int pageNo=0;
  if (page != null && page > 0) {
    pageNo=page;
  }
  int numberOfRecords=10;
  if (limit != null && limit > 0) {
    numberOfRecords=limit;
  }
  Pageable topRecords=new PageRequest(pageNo,numberOfRecords);
  Page<Conversation> result=itemRepository.findAll(topRecords);
  List<Conversation> content=result.getContent();
  for (  Conversation item : content) {
    RfRequest rfRequest=item.getRfRequest();
    logger.debug(rfRequest.getApiUrlString());
  }
  return content;
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public @ResponseBody PaginatedResponse<Conversation> findAll(@RequestParam(value="String_Node_Str",required=false) Integer page,@RequestParam(value="String_Node_Str",required=false) Integer limit){
  logger.debug("String_Node_Str");
  int pageNo=0;
  if (page != null && page > 0) {
    pageNo=page;
  }
  int numberOfRecords=10;
  if (limit != null && limit > 0) {
    numberOfRecords=limit;
  }
  Sort sort=new Sort(Direction.DESC,"String_Node_Str");
  Pageable topRecords=new PageRequest(pageNo,numberOfRecords,sort);
  Page<Conversation> result=itemRepository.findAll(topRecords);
  List<Conversation> content=result.getContent();
  PaginatedResponse<Conversation> response=new PaginatedResponse<Conversation>();
  response.setData(content);
  response.setLimit(numberOfRecords);
  response.setPage(pageNo);
  response.setTotalElements(result.getTotalElements());
  response.setTotalPages(result.getTotalPages());
  for (  Conversation item : content) {
    RfRequest rfRequest=item.getRfRequest();
    logger.debug(rfRequest.getApiUrlString());
  }
  return response;
}
Program: 79843
Project: 79843
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.PUT,headers="String_Node_Str") public @ResponseBody Conversation update(@PathVariable("String_Node_Str") Long conversationId,@RequestBody ConversationDTO updated){
  logger.debug("String_Node_Str" + updated);
  Conversation item=itemRepository.findOne(updated.getId());
  item.setName(updated.getName());
  item.setDescription(updated.getDescription());
  RfRequestDTO rfRequestDTO=updated.getRfRequestDTO();
  RfRequest rfRequest=item.getRfRequest();
  if (null != rfRequestDTO) {
    rfRequest.setApiUrlString(rfRequestDTO.getApiUrl());
    if (rfRequestDTO.getApiBody() != null) {
      rfRequest.setApiBody(rfRequestDTO.getApiBody().getBytes());
    }
    rfRequest.setMethodType(rfRequestDTO.getMethodType());
  }
  item.setRfRequest(rfRequest);
  return item;
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.PUT,headers="String_Node_Str") public @ResponseBody Conversation update(@PathVariable("String_Node_Str") String conversationId,@RequestBody ConversationDTO updated){
  logger.debug("String_Node_Str" + updated);
  Conversation item=itemRepository.findOne(updated.getId());
  item.setName(updated.getName());
  item.setDescription(updated.getDescription());
  RfRequestDTO rfRequestDTO=updated.getRfRequestDTO();
  RfRequest rfRequest=item.getRfRequest();
  if (null != rfRequestDTO) {
    rfRequest.setApiUrlString(rfRequestDTO.getApiUrl());
    if (rfRequestDTO.getApiBody() != null) {
      rfRequest.setApiBody(rfRequestDTO.getApiBody().getBytes());
    }
    rfRequest.setMethodType(rfRequestDTO.getMethodType());
  }
  item.setRfRequest(rfRequest);
  return item;
}
Program: 79845
Project: 79845
Buggy source:
public void setHeaderValue(String headerValue){
  this.headerValue=headerValue;
}

Fixed version (ground truth):
public void setHeaderValue(byte[] headerValue){
  this.headerValue=headerValue;
}
Program: 79846
Project: 79846
Buggy source:
public String getHeaderValue(){
  return headerValue;
}

Fixed version (ground truth):
public byte[] getHeaderValue(){
  return headerValue;
}
Program: 79847
Project: 79847
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST) public ModelAndView oauthFormRedirect(@ModelAttribute OAuth2RequestDTO oAuth2RequestDTO){
  List<String> scopes=oAuth2RequestDTO.getScopes();
  String url=new BrowserClientRequestUrl(oAuth2RequestDTO.getAuthorizationUrl(),oAuth2RequestDTO.getClientId()).setState("String_Node_Str").setScopes(scopes).setRedirectUri("String_Node_Str").build();
  return new ModelAndView("String_Node_Str" + url);
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST) public ModelAndView oauthFormRedirect(@ModelAttribute OAuth2RequestDTO oAuth2RequestDTO) throws URISyntaxException {
  List<String> scopes=oAuth2RequestDTO.getScopes();
  String authorizationUrl=oAuth2RequestDTO.getAuthorizationUrl();
  if (authorizationUrl == null || authorizationUrl.isEmpty()) {
    return null;
  }
  URIBuilder uriBuilder=new URIBuilder(authorizationUrl);
  List<NameValuePair> queryParams=uriBuilder.getQueryParams();
  List<String> responseTypes=new ArrayList<String>();
  if (queryParams != null && !queryParams.isEmpty()) {
    for (    NameValuePair nameValuePair : queryParams) {
      if ("String_Node_Str".equals(nameValuePair.getName())) {
        responseTypes.add(nameValuePair.getValue());
        break;
      }
    }
  }
  BrowserClientRequestUrl browserClientRequestUrl=new BrowserClientRequestUrl(authorizationUrl,oAuth2RequestDTO.getClientId());
  if (!responseTypes.isEmpty()) {
    browserClientRequestUrl=browserClientRequestUrl.setResponseTypes(responseTypes);
  }
  String url=browserClientRequestUrl.setState("String_Node_Str").setScopes(scopes).setRedirectUri("String_Node_Str").build();
  return new ModelAndView("String_Node_Str" + url);
}
Program: 79848
Project: 79848
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.PUT,headers="String_Node_Str") public @ResponseBody User update(@PathVariable("String_Node_Str") Long id,@RequestBody UserDTO updated){
  logger.debug("String_Node_Str" + updated);
  Authentication authentication=SecurityContextHolder.getContext().getAuthentication();
  Object principal=authentication.getPrincipal();
  System.out.println("String_Node_Str" + principal);
  User user=userRepository.findOne(updated.getId());
  user.setName(updated.getName());
  user.setDescription(updated.getDescription());
  user.setEmail(updated.getEmail());
  return user;
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.PUT,headers="String_Node_Str") public @ResponseBody UserDTO update(@PathVariable("String_Node_Str") Long id,@RequestBody UserDTO updated){
  logger.debug("String_Node_Str" + updated);
  Authentication authentication=SecurityContextHolder.getContext().getAuthentication();
  Object principal=authentication.getPrincipal();
  if (principal != null && principal instanceof User) {
    User loggedInUser=(User)principal;
    Long updatedId=updated.getId();
    User user=userRepository.findOne(updatedId);
    if (updatedId == loggedInUser.getId()) {
      user.setName(updated.getName());
      user.setDescription(updated.getDescription());
      user.setEmail(updated.getEmail());
      userRepository.save(user);
    }
  }
  return updated;
}
Program: 79849
Project: 79849
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,headers="String_Node_Str") public @ResponseBody void changePassword(@RequestBody PasswordResetDTO passwordResetDTO){
  Authentication authentication=SecurityContextHolder.getContext().getAuthentication();
  Object principal=authentication.getPrincipal();
  System.out.println("String_Node_Str" + principal);
  Object details=authentication.getDetails();
  System.out.println("String_Node_Str" + details);
  Object credentials=authentication.getCredentials();
  System.out.println("String_Node_Str" + credentials);
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,headers="String_Node_Str") public @ResponseBody void changePassword(@RequestBody PasswordResetDTO passwordResetDTO){
  Authentication authentication=SecurityContextHolder.getContext().getAuthentication();
  Object principal=authentication.getPrincipal();
  if (principal != null && principal instanceof User) {
    User loggedInUser=(User)principal;
    User user=userRepository.findOne(loggedInUser.getId());
    PasswordEncoder passwordEncoder=new BCryptPasswordEncoder();
    user.setPassword(passwordEncoder.encode(passwordResetDTO.getRetypedPassword()));
    userRepository.save(user);
  }
}
Program: 79850
Project: 79850
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,headers="String_Node_Str") public @ResponseBody BaseNode create(@RequestBody NodeDTO nodeDTO){
  logger.debug("String_Node_Str" + nodeDTO);
  BaseNode node=new BaseNode();
  node.setName(nodeDTO.getName());
  node.setDescription(nodeDTO.getDescription());
  return nodeRepository.save(node);
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,headers="String_Node_Str") public @ResponseBody BaseNode create(@PathVariable("String_Node_Str") Long parentId,@RequestBody NodeDTO nodeDTO){
  logger.debug("String_Node_Str" + nodeDTO);
  BaseNode node=new BaseNode();
  node.setName(nodeDTO.getName());
  node.setDescription(nodeDTO.getDescription());
  node.setParentId(parentId);
  return nodeRepository.save(node);
}
Program: 79851
Project: 79851
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public @ResponseBody Project findById(@PathVariable("String_Node_Str") Long id){
  logger.debug("String_Node_Str" + id);
  return projectRepository.findOne(id);
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public @ResponseBody Project findById(@PathVariable("String_Node_Str") Long workspaceId,@PathVariable("String_Node_Str") Long id){
  logger.debug("String_Node_Str" + id);
  return projectRepository.findOne(id);
}
Program: 79852
Project: 79852
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,headers="String_Node_Str") public @ResponseBody Project create(@RequestBody ProjectDTO projectDTO){
  logger.debug("String_Node_Str" + projectDTO);
  Project project=new Project();
  project.setName(projectDTO.getName());
  project.setDescription(projectDTO.getDescription());
  BaseNode projectRef=new BaseNode();
  projectRef.setName(projectDTO.getName());
  projectRef.setNodeType("String_Node_Str");
  projectRef.setParentId("String_Node_Str");
  BaseNode savedRef=nodeRepository.save(projectRef);
  project.setProjectRef(savedRef);
  return projectRepository.save(project);
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,headers="String_Node_Str") public @ResponseBody Project create(@PathVariable("String_Node_Str") Long workspaceId,@RequestBody ProjectDTO projectDTO){
  logger.debug("String_Node_Str" + projectDTO);
  Project project=new Project();
  project.setName(projectDTO.getName());
  project.setDescription(projectDTO.getDescription());
  Workspace workspace=workspaceRepository.findOne(workspaceId);
  project.setWorkspace(workspace);
  BaseNode projectRef=new BaseNode();
  projectRef.setName(projectDTO.getName());
  projectRef.setNodeType("String_Node_Str");
  projectRef.setParentId(Long.valueOf(-1));
  BaseNode savedRef=nodeRepository.save(projectRef);
  project.setProjectRef(savedRef);
  return projectRepository.save(project);
}