nus-yam/ex-repair huggingface dataset:
Program: 162378
Project: 162378
Buggy source:
@Override public void run(){
  long currentTime=SystemClock.uptimeMillis();
  long diff=currentTime - mStartTime;
  if (diff < mDuration) {
    float interpolation=mInterpolator.getInterpolation((float)diff / (float)mDuration);
    scheduleSelf(mUpdater,currentTime + FRAME_DURATION);
    updateAnimation(interpolation);
  }
 else {
    unscheduleSelf(mUpdater);
    mRunning=false;
    updateAnimation(1f);
  }
}

Fixed version (ground truth):
@Override public void run(){
  long currentTime=SystemClock.uptimeMillis();
  long diff=currentTime - mStartTime;
  if (diff < mDuration) {
    float interpolation=mInterpolator.getInterpolation((float)diff / (float)mDuration);
    scheduleSelf(mUpdater,currentTime + Ui.FRAME_DURATION);
    updateAnimation(interpolation);
  }
 else {
    unscheduleSelf(mUpdater);
    mRunning=false;
    updateAnimation(1f);
  }
}
Program: 162379
Project: 162379
Buggy source:
@Override public void draw(Canvas canvas,Paint paint){
  final float scale=mCurrentScale;
  if (scale > INACTIVE_SCALE) {
    final Rect bounds=getBounds();
    float radius=(Math.min(bounds.width(),bounds.height()) / 2.0f);
    float radiusAnimated=radius * scale;
    if (radius > 0) {
      int preAlpha=setPaintAlpha(paint);
      if (paint.getAlpha() > 0) {
        canvas.drawCircle(bounds.centerX(),bounds.centerY(),radius,paint);
      }
      if (radiusAnimated > 0) {
        if (preAlpha < 255) {
          preAlpha=getRippleAlpha(preAlpha,paint.getAlpha());
        }
        if (preAlpha > 0) {
          paint.setAlpha(preAlpha);
          canvas.drawCircle(bounds.centerX(),bounds.centerY(),radiusAnimated,paint);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void draw(Canvas canvas,Paint paint){
  final float scale=mCurrentScale;
  if (scale > 0) {
    if (scale != 1f && mBackgroundAlpha > 0) {
      paint.setAlpha(mBackgroundAlpha);
      canvas.drawCircle(mCenterX,mCenterY,mBackgroundRadius,paint);
    }
    if (mRippleAlpha > 0) {
      paint.setAlpha(mRippleAlpha);
      canvas.drawCircle(mCenterX,mCenterY,mBackgroundRadius * scale,paint);
    }
  }
}
Program: 162380
Project: 162380
Buggy source:
private void updateAnimation(float factor){
  float initial=mAnimationInitialValue;
  float destination=mReverse ? INACTIVE_SCALE : ACTIVE_SCALE;
  mCurrentScale=initial + (destination - initial) * factor;
  invalidateSelf();
}

Fixed version (ground truth):
private void updateAnimation(float factor){
  float initial=mAnimationInitialValue;
  float destination=mReverse ? 0 : 1f;
  mCurrentScale=initial + (destination - initial) * factor;
  invalidateSelf();
}
Program: 162381
Project: 162381
Buggy source:
public void animateToNormal(){
  mReverse=true;
  unscheduleSelf(mUpdater);
  if (mCurrentScale > 0) {
    mRunning=true;
    mAnimationInitialValue=mCurrentScale;
    float durationFactor=1f - mCurrentScale;
    mDuration=ANIMATION_DURATION - (int)(ANIMATION_DURATION * durationFactor);
    mStartTime=SystemClock.uptimeMillis();
    scheduleSelf(mUpdater,mStartTime + FRAME_DURATION);
  }
 else {
    notifyFinishedToListener();
  }
}

Fixed version (ground truth):
public void animateToNormal(){
  mReverse=true;
  unscheduleSelf(mUpdater);
  if (mCurrentScale > 0) {
    mRunning=true;
    mAnimationInitialValue=mCurrentScale;
    float durationFactor=1f - mCurrentScale;
    mDuration=Ui.ANIMATION_DURATION - (int)(Ui.ANIMATION_DURATION * durationFactor);
    mStartTime=SystemClock.uptimeMillis();
    scheduleSelf(mUpdater,mStartTime + Ui.FRAME_DURATION);
  }
 else {
    notifyFinishedToListener();
  }
}
Program: 162382
Project: 162382
Buggy source:
public void animateToPressed(){
  unscheduleSelf(mUpdater);
  mReverse=false;
  if (mCurrentScale < 1) {
    mRunning=true;
    mAnimationInitialValue=mCurrentScale;
    float durationFactor=1f - mCurrentScale;
    mDuration=(int)(ANIMATION_DURATION * durationFactor);
    mStartTime=SystemClock.uptimeMillis();
    scheduleSelf(mUpdater,mStartTime + FRAME_DURATION);
  }
 else {
    notifyFinishedToListener();
  }
}

Fixed version (ground truth):
public void animateToPressed(){
  unscheduleSelf(mUpdater);
  mReverse=false;
  if (mCurrentScale < 1) {
    mRunning=true;
    mAnimationInitialValue=mCurrentScale;
    float durationFactor=1f - mCurrentScale;
    mDuration=(int)(Ui.ANIMATION_DURATION * durationFactor);
    mStartTime=SystemClock.uptimeMillis();
    scheduleSelf(mUpdater,mStartTime + Ui.FRAME_DURATION);
  }
 else {
    notifyFinishedToListener();
  }
}
Program: 162383
Project: 162383
Buggy source:
@Override public void run(){
  long currentTime=SystemClock.uptimeMillis();
  long diff=currentTime - mStartTime;
  if (diff < mDuration) {
    float interpolation=mInterpolator.getInterpolation((float)diff / (float)mDuration);
    scheduleSelf(mUpdater,currentTime + FRAME_DURATION);
    updateAnimation(interpolation);
  }
 else {
    unscheduleSelf(mUpdater);
    mRunning=false;
    updateAnimation(1f);
    notifyFinishedToListener();
  }
}

Fixed version (ground truth):
@Override public void run(){
  long currentTime=SystemClock.uptimeMillis();
  long diff=currentTime - mStartTime;
  if (diff < mDuration) {
    float interpolation=mInterpolator.getInterpolation((float)diff / (float)mDuration);
    scheduleSelf(mUpdater,currentTime + Ui.FRAME_DURATION);
    updateAnimation(interpolation);
  }
 else {
    unscheduleSelf(mUpdater);
    mRunning=false;
    updateAnimation(1f);
    notifyFinishedToListener();
  }
}
Program: 162384
Project: 162384
Buggy source:
@Override public void draw(Canvas canvas,Paint paint){
  if (!mPath.isEmpty()) {
    int color=blendColors(mStartColor,mEndColor,mCurrentScale);
    paint.setColor(color);
    canvas.drawPath(mPath,paint);
  }
}

Fixed version (ground truth):
@Override public void draw(Canvas canvas,Paint paint){
  if (!mPath.isEmpty()) {
    paint.setColor(mCurColor);
    canvas.drawPath(mPath,paint);
  }
}
Program: 162385
Project: 162385
Buggy source:
public void onOpeningComplete();

Fixed version (ground truth):
void onOpeningComplete();
Program: 162386
Project: 162386
Buggy source:
public void onClosingComplete();

Fixed version (ground truth):
void onClosingComplete();
Program: 162387
Project: 162387
Buggy source:
private void updateAnimation(float factor){
  float initial=mAnimationInitialValue;
  float destination=mReverse ? 0f : 1f;
  mCurrentScale=initial + (destination - initial) * factor;
  computePath(getBounds());
  invalidateSelf();
}

Fixed version (ground truth):
private void updateAnimation(float factor){
  float initial=mAnimationInitialValue;
  float destination=mReverse ? 0f : 1f;
  mCurrentScale=initial + (destination - initial) * factor;
  mCurColor=blendColors(mStartColor,mEndColor,mCurrentScale);
  computePath(getBounds());
  invalidateSelf();
}
Program: 162388
Project: 162388
Buggy source:
private void draw(Canvas canvas,Paint paint,int thumbColor,int thumbAlpha,int colorLeft,int colorRight,int alphaLeft,int alphaRight,float halfLeft,float halfRight){
  Rect bounds=getBounds();
  int thumbX=mPoint.x;
  int thumbY=mPoint.y;
  int startLeft=bounds.left + mTouchRadius;
  int startRight=bounds.right - mTouchRadius;
  if (halfLeft > 0) {
    paint.setColor(colorLeft);
    paint.setAlpha(alphaLeft);
    canvas.drawRect(startLeft,thumbY - halfLeft,thumbX,thumbY + halfLeft,paint);
  }
  if (halfRight > 0) {
    paint.setColor(colorRight);
    paint.setAlpha(alphaRight);
    canvas.drawRect(thumbX,thumbY - halfRight,startRight,thumbY + halfRight,paint);
  }
  if (mTickRadius > halfRight) {
    for (int i=0; i <= mNumSegments; i++) {
      float x=startRight - i * mTickDistance;
      if (x <= thumbX)       break;
      canvas.drawCircle(x,thumbY,mTickRadius,paint);
    }
  }
  if (mThumbRadius > halfLeft) {
    paint.setColor(colorLeft);
    paint.setAlpha(alphaLeft);
    for (int i=0; i <= mNumSegments; i++) {
      float x=i * mTickDistance + startLeft;
      if (x > thumbX)       break;
      canvas.drawCircle(x,thumbY,mTickRadius,paint);
    }
  }
  if (!isOpen && mThumbRadius > 0) {
    paint.setColor(thumbColor);
    paint.setAlpha(thumbAlpha);
    canvas.drawCircle(thumbX,thumbY,mThumbRadius,paint);
  }
}

Fixed version (ground truth):
private void draw(Canvas canvas,Paint paint,int thumbColor,int colorLeft,int colorRight,float halfLeft,float halfRight){
  Rect bounds=getBounds();
  int thumbX=mPoint.x;
  int thumbY=mPoint.y;
  int startLeft=bounds.left + mTouchRadius;
  int startRight=bounds.right - mTouchRadius;
  if (halfLeft > 0) {
    paint.setColor(colorLeft);
    canvas.drawRect(startLeft,thumbY - halfLeft,thumbX,thumbY + halfLeft,paint);
  }
  if (halfRight > 0) {
    paint.setColor(colorRight);
    canvas.drawRect(thumbX,thumbY - halfRight,startRight,thumbY + halfRight,paint);
  }
  if (mTickRadius > halfRight) {
    for (int i=0; i <= mNumSegments; i++) {
      float x=startRight - i * mTickDistance;
      if (x <= thumbX)       break;
      canvas.drawCircle(x,thumbY,mTickRadius,paint);
    }
  }
  if (mThumbRadius > halfLeft) {
    paint.setColor(colorLeft);
    for (int i=0; i <= mNumSegments; i++) {
      float x=i * mTickDistance + startLeft;
      if (x > thumbX)       break;
      canvas.drawCircle(x,thumbY,mTickRadius,paint);
    }
  }
  if (!isOpen && mThumbRadius > 0) {
    paint.setColor(thumbColor);
    canvas.drawCircle(thumbX,thumbY,mThumbRadius,paint);
  }
}
Program: 162389
Project: 162389
Buggy source:
@Override public void draw(Canvas canvas,Paint paint){
  int preAlpha=setPaintAlpha(paint,mAlpha);
  if (paint.getAlpha() > 0) {
    canvas.drawColor(paint.getColor());
  }
  if (mRadius > 0) {
    if (preAlpha < 255) {
      preAlpha=getCircleAlpha(preAlpha,paint.getAlpha());
      paint.setAlpha(preAlpha);
    }
    if (mCircleAlpha != 255)     setPaintAlpha(paint,mCircleAlpha);
    canvas.drawCircle(mPaintX,mPaintY,mRadius,paint);
  }
}

Fixed version (ground truth):
@Override public void draw(Canvas canvas,Paint paint){
  int preAlpha=setPaintAlpha(paint,mAlpha);
  if (paint.getAlpha() > 0) {
    canvas.drawColor(paint.getColor());
  }
  if (mRadius > 0) {
    if (preAlpha < 255) {
      preAlpha=getCircleAlpha(preAlpha,paint.getAlpha());
    }
    paint.setAlpha(preAlpha);
    setPaintAlpha(paint,mCircleAlpha);
    if (paint.getAlpha() > 0) {
      canvas.drawCircle(mPaintX,mPaintY,mRadius,paint);
    }
  }
}
Program: 162390
Project: 162390
Buggy source:
@Override public void draw(Canvas canvas,Paint paint){
  Rect bounds=getBounds();
  int size=Math.min(bounds.width(),bounds.height());
  float scale=mCurrentScale;
  int rippleColor=mRippleColor;
  int bgColor=mRippleBgColor;
  float radius=(size / 2);
  float radiusAnimated=radius * scale;
  if (scale > INACTIVE_SCALE) {
    if (bgColor != 0) {
      paint.setColor(bgColor);
      paint.setAlpha(decreasedAlpha(Color.alpha(bgColor)));
      canvas.drawCircle(bounds.centerX(),bounds.centerY(),radius,paint);
    }
    if (rippleColor != 0) {
      paint.setColor(rippleColor);
      paint.setAlpha(GeniusUi.modulateAlpha(paint.getAlpha(),Color.alpha(rippleColor)));
      canvas.drawCircle(bounds.centerX(),bounds.centerY(),radiusAnimated,paint);
    }
  }
}

Fixed version (ground truth):
@Override public void draw(Canvas canvas,Paint paint){
  Rect bounds=getBounds();
  int size=Math.min(bounds.width(),bounds.height());
  float scale=mCurrentScale;
  int rippleColor=mRippleColor;
  int bgColor=mRippleBgColor;
  float radius=(size / 2);
  float radiusAnimated=radius * scale;
  if (scale > INACTIVE_SCALE) {
    if (bgColor != 0) {
    }
    if (rippleColor != 0) {
      canvas.drawCircle(bounds.centerX(),bounds.centerY(),radiusAnimated,paint);
    }
  }
}
Program: 162391
Project: 162391
Buggy source:
@Override protected synchronized void onDraw(Canvas canvas){
  super.onDraw(canvas);
  mSeekBarDrawable.draw(canvas);
  mRipple.draw(canvas);
}

Fixed version (ground truth):
@Override protected synchronized void onDraw(Canvas canvas){
  super.onDraw(canvas);
  mSeekBarDrawable.draw(canvas);
  if (isEnabled())   mRipple.draw(canvas);
}
Program: 162392
Project: 162392
Buggy source:
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public BalloonMarker(Context context,AttributeSet attrs,int defStyleAttr,String maxValue){
  super(context,attrs,defStyleAttr);
  DisplayMetrics displayMetrics=context.getResources().getDisplayMetrics();
  int padding=(int)(PADDING_DP * displayMetrics.density) * 2;
  mNumber=new TextView(context);
  mNumber.setPadding(padding,0,padding,0);
  mNumber.setGravity(Gravity.CENTER);
  mNumber.setText(maxValue);
  mNumber.setMaxLines(1);
  mNumber.setSingleLine(true);
  GeniusCompat.setTextDirection(mNumber,TEXT_DIRECTION_LOCALE);
  mNumber.setVisibility(View.INVISIBLE);
  setPadding(padding,padding,padding,padding);
  resetSizes(maxValue);
  mSeparation=(int)(SEPARATION_DP * displayMetrics.density);
  mBalloonMarkerDrawable=new BalloonMarkerDrawable(ColorStateList.valueOf(Color.TRANSPARENT),0);
  mBalloonMarkerDrawable.setCallback(this);
  mBalloonMarkerDrawable.setMarkerListener(this);
  mBalloonMarkerDrawable.setExternalOffset(padding);
  GeniusCompat.setOutlineProvider(this,mBalloonMarkerDrawable);
  if (attrs != null) {
    TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.BalloonMarker,defStyleAttr,R.style.BalloonMarkerStyle);
    int textAppearanceId=a.getResourceId(R.styleable.BalloonMarker_gMarkerTextAppearance,R.style.BalloonMarkerTextAppearanceStyle);
    setTextAppearance(textAppearanceId);
    ColorStateList color=a.getColorStateList(R.styleable.BalloonMarker_gMarkerBackgroundColor);
    setBackgroundColor(color);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      float elevation=a.getDimension(R.styleable.BalloonMarker_gMarkerElevation,ELEVATION_DP * displayMetrics.density);
      ViewCompat.setElevation(this,elevation);
    }
    a.recycle();
  }
}

Fixed version (ground truth):
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public BalloonMarker(Context context,AttributeSet attrs,int defStyleAttr,int defStyleRes){
  super(context,attrs,defStyleAttr,defStyleRes);
  init(context,attrs,defStyleAttr,defStyleRes,"String_Node_Str");
}
Program: 162393
Project: 162393
Buggy source:
public boolean isPerformClick(){
  if (!isPerformClick) {
    isPerformClick=true;
    return false;
  }
 else {
    return !isRunning;
  }
}

Fixed version (ground truth):
public boolean isPerformClick(){
  if (!isPerformClick) {
    isPerformClick=true;
    return false;
  }
 else {
    if (isRunning)     return false;
 else {
      isPerformClick=false;
      return true;
    }
  }
}
Program: 162394
Project: 162394
Buggy source:
public void onTouch(MotionEvent event){
switch (event.getActionMasked()) {
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
{
      isTouchReleased=true;
      onTouchReleased(event.getX(),event.getY());
    }
  break;
case MotionEvent.ACTION_DOWN:
{
  isTouchReleased=false;
  onTouchDown(event.getX(),event.getY());
}
break;
case MotionEvent.ACTION_MOVE:
onTouchMove(event.getX(),event.getY());
break;
}
}

Fixed version (ground truth):
public boolean onTouch(MotionEvent event){
switch (event.getActionMasked()) {
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
{
      isTouchReleased=true;
      onTouchReleased(event.getX(),event.getY());
    }
  break;
case MotionEvent.ACTION_DOWN:
{
  isTouchReleased=false;
  onTouchDown(event.getX(),event.getY());
}
break;
case MotionEvent.ACTION_MOVE:
onTouchMove(event.getX(),event.getY());
break;
default :
return false;
}
return true;
}
Program: 162395
Project: 162395
Buggy source:
@Override public boolean onTouchEvent(MotionEvent event){
  boolean bFlag=super.onTouchEvent(event);
  final TouchEffectDrawable d=mTouchDrawable;
  if (d != null && isEnabled()) {
    d.onTouch(event);
    return true;
  }
  return bFlag;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent event){
  final TouchEffectDrawable d=mTouchDrawable;
  if (d != null && isEnabled()) {
    d.onTouch(event);
    super.onTouchEvent(event);
    return true;
  }
  return super.onTouchEvent(event);
}
Program: 162396
Project: 162396
Buggy source:
@Override public void perform(){
  Runnable runnable=new Runnable(){
    @Override public void run(){
      performClick();
    }
  }
;
  if (!this.post(runnable)) {
    this.performClick();
  }
}

Fixed version (ground truth):
@Override public void perform(){
  Runnable runnable=new Runnable(){
    @Override public void run(){
      performClick();
    }
  }
;
  if (!this.post(runnable)) {
    performClick();
  }
}
Program: 162397
Project: 162397
Buggy source:
@Override public boolean onTouchEvent(MotionEvent event){
  boolean bFlag=super.onTouchEvent(event);
  final TouchEffectDrawable d=mTouchDrawable;
  if (d != null && isEnabled()) {
    d.onTouch(event);
    return true;
  }
  return bFlag;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent event){
  final TouchEffectDrawable d=mTouchDrawable;
  if (d != null && isEnabled()) {
    d.onTouch(event);
    super.onTouchEvent(event);
    return true;
  }
  return super.onTouchEvent(event);
}
Program: 162398
Project: 162398
Buggy source:
@Override public void perform(){
  Runnable runnable=new Runnable(){
    @Override public void run(){
      performClick();
    }
  }
;
  if (!this.post(runnable)) {
    this.performClick();
  }
}

Fixed version (ground truth):
@Override public void perform(){
  Runnable runnable=new Runnable(){
    @Override public void run(){
      performClick();
    }
  }
;
  if (!this.post(runnable)) {
    performClick();
  }
}
Program: 162399
Project: 162399
Buggy source:
@Override public char[] reqPassword(Resource<?> resource){
  return keyPassphrase.toCharArray();
}

Fixed version (ground truth):
@Override public char[] reqPassword(Resource<?> resource){
  return textfield.getText().toString().toCharArray();
}
Program: 162400
Project: 162400
Buggy source:
@Override protected void onProgressUpdate(Void... values){
  super.onProgressUpdate(values);
}

Fixed version (ground truth):
@Override protected void onProgressUpdate(IOException... values){
  super.onProgressUpdate(values);
  if (values.length < 1)   return;
  IOException result=values[0];
  MaterialDialog.Builder builder=new MaterialDialog.Builder(AppConfig.getInstance().getActivityContext());
  View dialogLayout=View.inflate(AppConfig.getInstance().getActivityContext(),R.layout.dialog_singleedittext,null);
  WarnableTextInputLayout wilTextfield=dialogLayout.findViewById(R.id.singleedittext_warnabletextinputlayout);
  EditText textfield=dialogLayout.findViewById(R.id.singleedittext_input);
  textfield.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
  builder.customView(dialogLayout,false).autoDismiss(false).title(R.string.ssh_key_prompt_passphrase).positiveText(R.string.ok).onPositive(((dialog,which) -> {
    this.passwordFinder=new PasswordFinder(){
      @Override public char[] reqPassword(      Resource<?> resource){
        return textfield.getText().toString().toCharArray();
      }
      @Override public boolean shouldRetry(      Resource<?> resource){
        return false;
      }
    }
;
    this.paused=false;
    dialog.dismiss();
  }
)).negativeText(R.string.cancel).onNegative(((dialog,which) -> {
    dialog.dismiss();
    toastOnParseError(result);
    cancel(true);
  }
));
  MaterialDialog dialog=builder.show();
  new WarnableTextInputValidator(AppConfig.getInstance().getActivityContext(),textfield,wilTextfield,dialog.getActionButton(DialogAction.POSITIVE),(text) -> {
    if (text.length() < 1) {
      return new WarnableTextInputValidator.ReturnState(WarnableTextInputValidator.ReturnState.STATE_ERROR,R.string.field_empty);
    }
    return new WarnableTextInputValidator.ReturnState();
  }
);
  if (errorMessage != null) {
    wilTextfield.setError(errorMessage);
    textfield.selectAll();
  }
}
Program: 162401
Project: 162401
Buggy source:
@Override protected AsyncTaskResult<KeyPair> doInBackground(Void... voids){
  AsyncTaskResult<KeyPair> retval=null;
  for (  Provider provider : Security.getProviders())   Log.d(TAG,"String_Node_Str" + provider.getName());
  try {
    for (    PemToKeyPairConverter converter : converters) {
      KeyPair keyPair=converter.convert(new String(pemFile));
      if (keyPair != null) {
        retval=new AsyncTaskResult<KeyPair>(keyPair);
        break;
      }
    }
    if (retval == null)     throw new IOException("String_Node_Str");
  }
 catch (  IOException e) {
    Log.e(TAG,"String_Node_Str",e);
    retval=new AsyncTaskResult<KeyPair>(e);
  }
  return retval;
}

Fixed version (ground truth):
@Override protected KeyPair doInBackground(Void... voids){
  while (true) {
    if (isCancelled())     return null;
    if (paused)     continue;
    for (    PemToKeyPairConverter converter : converters) {
      KeyPair keyPair=converter.convert(new String(pemFile));
      if (keyPair != null) {
        paused=false;
        return keyPair;
      }
    }
    if (this.passwordFinder != null) {
      this.errorMessage=AppConfig.getInstance().getString(R.string.ssh_key_invalid_passphrase);
    }
    paused=true;
    publishProgress(new IOException("String_Node_Str"));
  }
}
Program: 162402
Project: 162402
Buggy source:
public PemToKeyPairTask(@NonNull byte[] pemContent,AsyncTaskResult.Callback<AsyncTaskResult<KeyPair>> callback,String keyPassphrase,MaterialDialog dialog,String errorMessage){
  this.pemFile=pemContent;
  this.callback=callback;
  this.dialog=dialog;
  this.errorMessage=errorMessage;
  if (keyPassphrase == null)   passwordFinder=null;
 else   passwordFinder=new PasswordFinder(){
    @Override public char[] reqPassword(    Resource<?> resource){
      return keyPassphrase.toCharArray();
    }
    @Override public boolean shouldRetry(    Resource<?> resource){
      return false;
    }
  }
;
}

Fixed version (ground truth):
private PemToKeyPairTask(@NonNull byte[] pemContent,AsyncTaskResult.Callback<KeyPair> callback){
  this.pemFile=pemContent;
  this.callback=callback;
}
Program: 162403
Project: 162403
Buggy source:
@Override protected void onPostExecute(AsyncTaskResult<KeyPair> result){
  if (result.exception != null) {
    if (dialog == null) {
      MaterialDialog.Builder builder=new MaterialDialog.Builder(AppConfig.getInstance().getActivityContext());
      View dialogLayout=View.inflate(AppConfig.getInstance().getActivityContext(),R.layout.dialog_singleedittext,null);
      WarnableTextInputLayout wilTextfield=dialogLayout.findViewById(R.id.singleedittext_warnabletextinputlayout);
      EditText textfield=dialogLayout.findViewById(R.id.singleedittext_input);
      textfield.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
      builder.customView(dialogLayout,false).autoDismiss(false).title(R.string.ssh_key_prompt_passphrase).positiveText(R.string.ok).onPositive(((dialog,which) -> {
        new PemToKeyPairTask(pemFile,callback,textfield.getText().toString(),dialog,AppConfig.getInstance().getString(R.string.ssh_key_invalid_passphrase)).execute();
      }
)).negativeText(R.string.cancel).onNegative(((dialog,which) -> {
        dialog.dismiss();
        toastOnParseError(result);
      }
));
      MaterialDialog dialog=builder.show();
      new WarnableTextInputValidator(AppConfig.getInstance().getActivityContext(),textfield,wilTextfield,dialog.getActionButton(DialogAction.POSITIVE),(text) -> {
        if (text.length() < 1) {
          return new WarnableTextInputValidator.ReturnState(WarnableTextInputValidator.ReturnState.STATE_ERROR,R.string.field_empty);
        }
        return new WarnableTextInputValidator.ReturnState();
      }
);
    }
 else {
      if (errorMessage != null) {
        WarnableTextInputLayout wilTextfield=(WarnableTextInputLayout)dialog.findViewById(R.id.singleedittext_warnabletextinputlayout);
        EditText textfield=(EditText)dialog.findViewById(R.id.singleedittext_input);
        wilTextfield.setError(errorMessage);
        textfield.selectAll();
      }
    }
  }
 else {
    if (dialog != null)     dialog.dismiss();
  }
  if (callback != null) {
    callback.onResult(result);
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(KeyPair result){
  if (callback != null) {
    callback.onResult(result);
  }
}
Program: 162404
Project: 162404
Buggy source:
private void toastOnParseError(AsyncTaskResult<KeyPair> result){
  Toast.makeText(AppConfig.getInstance().getActivityContext(),AppConfig.getInstance().getResources().getString(R.string.ssh_pem_key_parse_error,result.exception.getLocalizedMessage()),Toast.LENGTH_LONG).show();
}

Fixed version (ground truth):
private void toastOnParseError(IOException result){
  Toast.makeText(AppConfig.getInstance().getActivityContext(),AppConfig.getInstance().getResources().getString(R.string.ssh_pem_key_parse_error,result.getLocalizedMessage()),Toast.LENGTH_LONG).show();
}
Program: 162405
Project: 162405
Buggy source:
@Override public KeyType getType() throws IOException {
  return KeyType.fromKey(getPublic());
}

Fixed version (ground truth):
@Override public KeyType getType(){
  return KeyType.fromKey(getPublic());
}
Program: 162406
Project: 162406
Buggy source:
@Override protected AsyncTaskResult<SSHClient> doInBackground(Void... voids){
  final SSHClient sshClient=new SSHClient(new CustomSshJConfig());
  sshClient.addHostKeyVerifier(hostKey);
  sshClient.setConnectTimeout(SSH_CONNECT_TIMEOUT);
  try {
    sshClient.connect(hostname,port);
    if (password != null && !"String_Node_Str".equals(password)) {
      sshClient.authPassword(username,password);
      return new AsyncTaskResult<SSHClient>(sshClient);
    }
 else {
      sshClient.authPublickey(username,new KeyProvider(){
        @Override public PrivateKey getPrivate(){
          return privateKey.getPrivate();
        }
        @Override public PublicKey getPublic(){
          return privateKey.getPublic();
        }
        @Override public KeyType getType() throws IOException {
          return KeyType.fromKey(getPublic());
        }
      }
);
      return new AsyncTaskResult<SSHClient>(sshClient);
    }
  }
 catch (  UserAuthException e) {
    e.printStackTrace();
    return new AsyncTaskResult<SSHClient>(e);
  }
catch (  TransportException e) {
    e.printStackTrace();
    return new AsyncTaskResult<SSHClient>(e);
  }
catch (  IOException e) {
    e.printStackTrace();
    return new AsyncTaskResult<SSHClient>(e);
  }
}

Fixed version (ground truth):
@Override protected AsyncTaskResult<SSHClient> doInBackground(Void... voids){
  final SSHClient sshClient=new SSHClient(new CustomSshJConfig());
  sshClient.addHostKeyVerifier(hostKey);
  sshClient.setConnectTimeout(SSH_CONNECT_TIMEOUT);
  try {
    sshClient.connect(hostname,port);
    if (password != null && !"String_Node_Str".equals(password)) {
      sshClient.authPassword(username,password);
      return new AsyncTaskResult<SSHClient>(sshClient);
    }
 else {
      sshClient.authPublickey(username,new KeyProvider(){
        @Override public PrivateKey getPrivate(){
          return privateKey.getPrivate();
        }
        @Override public PublicKey getPublic(){
          return privateKey.getPublic();
        }
        @Override public KeyType getType(){
          return KeyType.fromKey(getPublic());
        }
      }
);
      return new AsyncTaskResult<SSHClient>(sshClient);
    }
  }
 catch (  UserAuthException e) {
    e.printStackTrace();
    return new AsyncTaskResult<SSHClient>(e);
  }
catch (  TransportException e) {
    e.printStackTrace();
    return new AsyncTaskResult<SSHClient>(e);
  }
catch (  IOException e) {
    e.printStackTrace();
    return new AsyncTaskResult<SSHClient>(e);
  }
}
Program: 162408
Project: 162408
Buggy source:
/** 
 * Set the PEM key for authentication when the Intent to browse file returned.
 */
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  if (SELECT_PEM_INTENT == requestCode && Activity.RESULT_OK == resultCode) {
    selectedPem=data.getData();
    Log.d(TAG,"String_Node_Str" + selectedPem.toString() + "String_Node_Str"+ selectedPem.getLastPathSegment());
    try {
      InputStream selectedKeyContent=context.getContentResolver().openInputStream(selectedPem);
      new PemToKeyPairTask(selectedKeyContent,result -> {
        if (result.result != null) {
          selectedParsedKeyPair=result.result;
          selectedParsedKeyPairName=selectedPem.getLastPathSegment().substring(selectedPem.getLastPathSegment().indexOf('/') + 1);
          MDButton okBTN=((MaterialDialog)getDialog()).getActionButton(DialogAction.POSITIVE);
          okBTN.setEnabled(okBTN.isEnabled() || true);
          Button selectPemBTN=getDialog().findViewById(R.id.selectPemBTN);
          selectPemBTN.setText(selectedParsedKeyPairName);
        }
      }
).execute();
    }
 catch (    FileNotFoundException e) {
      Log.e(TAG,"String_Node_Str",e);
    }
catch (    IOException shouldNotHappen) {
    }
  }
}

Fixed version (ground truth):
/** 
 * Set the PEM key for authentication when the Intent to browse file returned.
 */
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  if (SELECT_PEM_INTENT == requestCode && Activity.RESULT_OK == resultCode) {
    selectedPem=data.getData();
    try {
      InputStream selectedKeyContent=context.getContentResolver().openInputStream(selectedPem);
      new PemToKeyPairTask(selectedKeyContent,result -> {
        if (result.result != null) {
          selectedParsedKeyPair=result.result;
          selectedParsedKeyPairName=selectedPem.getLastPathSegment().substring(selectedPem.getLastPathSegment().indexOf('/') + 1);
          MDButton okBTN=((MaterialDialog)getDialog()).getActionButton(DialogAction.POSITIVE);
          okBTN.setEnabled(okBTN.isEnabled() || true);
          Button selectPemBTN=getDialog().findViewById(R.id.selectPemBTN);
          selectPemBTN.setText(selectedParsedKeyPairName);
        }
      }
).execute();
    }
 catch (    FileNotFoundException e) {
      Log.e(TAG,"String_Node_Str",e);
    }
catch (    IOException shouldNotHappen) {
    }
  }
}
Program: 162409
Project: 162409
Buggy source:
public String parseSftpPath(String a){
  if (a.contains("String_Node_Str"))   return "String_Node_Str" + a.substring(a.indexOf("String_Node_Str") + 1,a.length());
 else   return a;
}

Fixed version (ground truth):
public String parseSftpPath(String a){
  if (a.contains("String_Node_Str"))   return "String_Node_Str" + a.substring(a.lastIndexOf("String_Node_Str") + 1,a.length());
 else   return a;
}
Program: 162410
Project: 162410
Buggy source:
/** 
 * Method handles encryption of plain text on various APIs
 */
public static String encryptPassword(Context context,String plainText) throws GeneralSecurityException, IOException {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    return CryptUtil.aesEncryptPassword(plainText);
  }
 else   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
    return CryptUtil.rsaEncryptPassword(context,plainText);
  }
 else   return plainText;
}

Fixed version (ground truth):
/** 
 * Method handles encryption of plain text on various APIs
 */
public static String encryptPassword(Context context,String plainText) throws GeneralSecurityException, IOException {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    return aesEncryptPassword(plainText);
  }
 else   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
    return rsaEncryptPassword(context,plainText);
  }
 else   return plainText;
}
Program: 162411
Project: 162411
Buggy source:
/** 
 * Method handles decryption of cipher text on various APIs
 */
public static String decryptPassword(Context context,String cipherText) throws GeneralSecurityException, IOException {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    return CryptUtil.aesDecryptPassword(cipherText);
  }
 else   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
    return CryptUtil.rsaDecryptPassword(context,cipherText);
  }
 else   return cipherText;
}

Fixed version (ground truth):
/** 
 * Method handles decryption of cipher text on various APIs
 */
public static String decryptPassword(Context context,String cipherText) throws GeneralSecurityException, IOException {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    return aesDecryptPassword(cipherText);
  }
 else   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
    return rsaDecryptPassword(context,cipherText);
  }
 else   return cipherText;
}
Program: 162413
Project: 162413
Buggy source:
/** 
 * Updates the status spans
 */
private void updateSpans(){
  String ftpAddress=getFTPAddressString();
  if (ftpAddress == null) {
    ftpAddress="String_Node_Str";
    Toast.makeText(getContext(),getResources().getString(R.string.local_inet_addr_error),Toast.LENGTH_SHORT).show();
  }
  String statusHead=getResources().getString(R.string.ftp_status_title) + "String_Node_Str";
  spannedStatusConnected=Html.fromHtml(statusHead + "String_Node_Str" + "String_Node_Str"+ accentColor+ "String_Node_Str"+ getResources().getString(R.string.ftp_status_running)+ "String_Node_Str"+ "String_Node_Str"+ ftpAddress+ "String_Node_Str");
  spannedStatusNoConnection=Html.fromHtml(statusHead + "String_Node_Str" + "String_Node_Str"+ Utils.getColor(getContext(),android.R.color.holo_red_light)+ "String_Node_Str"+ getResources().getString(R.string.ftp_status_no_connection)+ "String_Node_Str");
  spannedStatusNotRunning=Html.fromHtml(statusHead + "String_Node_Str" + getResources().getString(R.string.ftp_status_not_running)+ "String_Node_Str");
  spannedStatusSecure=Html.fromHtml(statusHead + "String_Node_Str" + "String_Node_Str"+ Utils.getColor(getContext(),android.R.color.holo_green_light)+ "String_Node_Str"+ getResources().getString(R.string.ftp_status_secure_connection)+ "String_Node_Str"+ "String_Node_Str"+ ftpAddress+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Updates the status spans
 */
private void updateSpans(){
  String ftpAddress=getFTPAddressString();
  if (ftpAddress == null) {
    ftpAddress="String_Node_Str";
    Toast.makeText(getContext(),getResources().getString(R.string.local_inet_addr_error),Toast.LENGTH_SHORT).show();
  }
  String statusHead=getResources().getString(R.string.ftp_status_title) + "String_Node_Str";
  spannedStatusConnected=Html.fromHtml(statusHead + "String_Node_Str" + "String_Node_Str"+ accentColor+ "String_Node_Str"+ getResources().getString(R.string.ftp_status_running)+ "String_Node_Str");
  spannedStatusUrl=Html.fromHtml("String_Node_Str" + ftpAddress);
  spannedStatusNoConnection=Html.fromHtml(statusHead + "String_Node_Str" + "String_Node_Str"+ Utils.getColor(getContext(),android.R.color.holo_red_light)+ "String_Node_Str"+ getResources().getString(R.string.ftp_status_no_connection)+ "String_Node_Str");
  spannedStatusNotRunning=Html.fromHtml(statusHead + "String_Node_Str" + getResources().getString(R.string.ftp_status_not_running)+ "String_Node_Str");
  spannedStatusSecure=Html.fromHtml(statusHead + "String_Node_Str" + "String_Node_Str"+ Utils.getColor(getContext(),android.R.color.holo_green_light)+ "String_Node_Str"+ getResources().getString(R.string.ftp_status_secure_connection)+ "String_Node_Str");
  spannedStatusUrl=Html.fromHtml("String_Node_Str" + ftpAddress);
}
Program: 162414
Project: 162414
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  updateSpans();
switch (intent.getAction()) {
case FtpService.ACTION_STARTED:
    if (getSecurePreference()) {
      statusText.setText(spannedStatusSecure);
    }
 else {
      statusText.setText(spannedStatusConnected);
    }
  ftpBtn.setText(getResources().getString(R.string.stop_ftp).toUpperCase());
break;
case FtpService.ACTION_FAILEDTOSTART:
statusText.setText(spannedStatusNotRunning);
Toast.makeText(getContext(),getResources().getString(R.string.unknown_error),Toast.LENGTH_LONG).show();
ftpBtn.setText(getResources().getString(R.string.start_ftp).toUpperCase());
break;
case FtpService.ACTION_STOPPED:
statusText.setText(spannedStatusNotRunning);
ftpBtn.setText(getResources().getString(R.string.start_ftp).toUpperCase());
break;
}
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  updateSpans();
switch (intent.getAction()) {
case FtpService.ACTION_STARTED:
    if (getSecurePreference()) {
      statusText.setText(spannedStatusSecure);
    }
 else {
      statusText.setText(spannedStatusConnected);
    }
  url.setText(spannedStatusUrl);
ftpBtn.setText(getResources().getString(R.string.stop_ftp).toUpperCase());
break;
case FtpService.ACTION_FAILEDTOSTART:
statusText.setText(spannedStatusNotRunning);
Toast.makeText(getContext(),getResources().getString(R.string.unknown_error),Toast.LENGTH_LONG).show();
ftpBtn.setText(getResources().getString(R.string.start_ftp).toUpperCase());
url.setText("String_Node_Str");
break;
case FtpService.ACTION_STOPPED:
statusText.setText(spannedStatusNotRunning);
url.setText("String_Node_Str");
ftpBtn.setText(getResources().getString(R.string.start_ftp).toUpperCase());
break;
}
}
Program: 162418
Project: 162418
Buggy source:
/** 
 * Determines whether cloud provider is installed or not
 */
public static final boolean isCloudProviderAvailable(Context context){
  PackageManager pm=context.getPackageManager();
  try {
    pm.getPackageInfo(CloudContract.APP_PACKAGE_NAME,PackageManager.GET_ACTIVITIES);
    return true;
  }
 catch (  PackageManager.NameNotFoundException e) {
    e.printStackTrace();
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Determines whether cloud provider is installed or not
 */
public static final boolean isCloudProviderAvailable(Context context){
  PackageManager pm=context.getPackageManager();
  try {
    pm.getPackageInfo(CloudContract.APP_PACKAGE_NAME,PackageManager.GET_ACTIVITIES);
    return true;
  }
 catch (  PackageManager.NameNotFoundException e) {
    return false;
  }
}
Program: 162419
Project: 162419
Buggy source:
public static boolean isEnabledWifiHotspot(Context context){
  boolean enabled=false;
  Log.d(TAG,"String_Node_Str");
  WifiManager wm=(WifiManager)context.getSystemService(Context.WIFI_SERVICE);
  try {
    Method method=wm.getClass().getDeclaredMethod("String_Node_Str");
    enabled=(Boolean)method.invoke(wm);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return enabled;
}

Fixed version (ground truth):
public static boolean isEnabledWifiHotspot(Context context){
  boolean enabled=false;
  Log.d(TAG,"String_Node_Str");
  WifiManager wm=(WifiManager)context.getSystemService(Context.WIFI_SERVICE);
  try {
    Method method=wm.getClass().getDeclaredMethod("String_Node_Str");
    enabled=(method != null) ? (Boolean)method.invoke(wm) : false;
  }
 catch (  Exception e) {
    e.printStackTrace();
    enabled=false;
  }
  return enabled;
}
Program: 162420
Project: 162420
Buggy source:
public static InetAddress getLocalInetAddress(Context context){
  if (!isConnectedToLocalNetwork(context) && !isEnabledWifiHotspot(context)) {
    Log.e(TAG,"String_Node_Str");
    return null;
  }
  if (isConnectedToWifi(context)) {
    WifiManager wm=(WifiManager)context.getSystemService(Context.WIFI_SERVICE);
    int ipAddress=wm.getConnectionInfo().getIpAddress();
    if (ipAddress == 0)     return null;
    return intToInet(ipAddress);
  }
  try {
    Enumeration<NetworkInterface> netinterfaces=NetworkInterface.getNetworkInterfaces();
    while (netinterfaces.hasMoreElements()) {
      NetworkInterface netinterface=netinterfaces.nextElement();
      Enumeration<InetAddress> addresses=netinterface.getInetAddresses();
      while (addresses.hasMoreElements()) {
        InetAddress address=addresses.nextElement();
        if (isEnabledWifiHotspot(context) && WIFI_AP_ADDRESS.equals(address.getHostAddress()))         return address;
        if (!address.isLoopbackAddress() && !address.isLinkLocalAddress())         return address;
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
public static InetAddress getLocalInetAddress(Context context){
  if (!isConnectedToLocalNetwork(context) && !isEnabledWifiHotspot(context)) {
    Log.e(TAG,"String_Node_Str");
    return null;
  }
  if (isConnectedToWifi(context)) {
    WifiManager wm=(WifiManager)context.getSystemService(Context.WIFI_SERVICE);
    int ipAddress=wm.getConnectionInfo().getIpAddress();
    if (ipAddress == 0)     return null;
    return intToInet(ipAddress);
  }
  try {
    Enumeration<NetworkInterface> netinterfaces=NetworkInterface.getNetworkInterfaces();
    while (netinterfaces.hasMoreElements()) {
      NetworkInterface netinterface=netinterfaces.nextElement();
      Enumeration<InetAddress> addresses=netinterface.getInetAddresses();
      while (addresses.hasMoreElements()) {
        InetAddress address=addresses.nextElement();
        if (WIFI_AP_ADDRESS.equals(address.getHostAddress()) && isEnabledWifiHotspot(context))         return address;
        if (!address.isLoopbackAddress() && !address.isLinkLocalAddress() && !isEnabledWifiHotspot(context))         return address;
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}
Program: 162423
Project: 162423
Buggy source:
/** 
 * Initializes the floating action button to act as to save data from an external intent
 */
private void initFabToSave(final ArrayList<Uri> uris){
  floatingActionButton.removeButton(findViewById(R.id.menu_new_folder));
  floatingActionButton.removeButton(findViewById(R.id.menu_new_file));
  floatingActionButton.removeButton(findViewById(R.id.menu_new_cloud));
  floatingActionButton.setMenuButtonIcon(R.drawable.ic_file_download_white_24dp);
  floatingActionButton.getMenuButton().setOnClickListener(v -> {
    FileUtil.writeUriToStorage(MainActivity.this,uris,getContentResolver(),getCurrentMainFragment().getCurrentPath());
    Toast.makeText(MainActivity.this,getResources().getString(R.string.saving),Toast.LENGTH_LONG).show();
    finish();
  }
);
  floatingActionButton.setVisibility(View.VISIBLE);
  floatingActionButton.getMenuButton().show();
}

Fixed version (ground truth):
/** 
 * Initializes the floating action button to act as to save data from an external intent
 */
private void initFabToSave(final ArrayList<Uri> uris){
  floatingActionButton.removeButton(findViewById(R.id.menu_new_folder));
  floatingActionButton.removeButton(findViewById(R.id.menu_new_file));
  floatingActionButton.removeButton(findViewById(R.id.menu_new_cloud));
  floatingActionButton.setMenuButtonIcon(R.drawable.ic_file_download_white_24dp);
  floatingActionButton.getMenuButton().setOnClickListener(v -> {
    if (uris != null && uris.size() > 0) {
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        File folder=new File(getCurrentMainFragment().getCurrentPath());
        int result=mainActivityHelper.checkFolder(folder,MainActivity.this);
        if (result == MainActivityHelper.WRITABLE_OR_ON_SDCARD) {
          FileUtil.writeUriToStorage(MainActivity.this,uris,getContentResolver(),getCurrentMainFragment().getCurrentPath());
          finish();
        }
 else {
          operation=DataUtils.SAVE_FILE;
          urisToBeSaved=uris;
          mainActivityHelper.checkFolder(folder,MainActivity.this);
        }
      }
 else {
        FileUtil.writeUriToStorage(MainActivity.this,uris,getContentResolver(),getCurrentMainFragment().getCurrentPath());
        Toast.makeText(MainActivity.this,getResources().getString(R.string.saving),Toast.LENGTH_LONG).show();
        finish();
      }
    }
  }
);
  floatingActionButton.setVisibility(View.VISIBLE);
  floatingActionButton.getMenuButton().show();
}
Program: 162425
Project: 162425
Buggy source:
@Override public Void onPostExecute(Object result){
  return null;
}

Fixed version (ground truth):
@Override public Void onPostExecute(Object result){
  if (result != null) {
    List<String> paths=(List<String>)result;
    if (paths.size() == 1) {
      Toast.makeText(mainActivity,mainActivity.getString(R.string.saved_single_file,paths.get(0)),Toast.LENGTH_LONG).show();
    }
 else {
      Toast.makeText(mainActivity,mainActivity.getString(R.string.saved_multi_files,paths.size()),Toast.LENGTH_LONG).show();
    }
  }
  return null;
}
Program: 162428
Project: 162428
Buggy source:
public void guideDialogForLEXA(String path){
  final MaterialDialog.Builder x=new MaterialDialog.Builder(mainActivity);
  x.theme(mainActivity.getAppTheme().getMaterialDialogTheme());
  x.title(R.string.needsaccess);
  LayoutInflater layoutInflater=(LayoutInflater)mainActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View view=layoutInflater.inflate(R.layout.lexadrawer,null);
  x.customView(view,true);
  TextView textView=view.findViewById(R.id.description);
  textView.setText(mainActivity.getString(R.string.needsaccesssummary) + path + mainActivity.getString(R.string.needsaccesssummary1));
  ((ImageView)view.findViewById(R.id.icon)).setImageResource(R.drawable.sd_operate_step);
  x.positiveText(R.string.open);
  x.negativeText(R.string.cancel);
  x.positiveColor(accentColor);
  x.negativeColor(accentColor);
  x.callback(new MaterialDialog.ButtonCallback(){
    @Override public void onPositive(    MaterialDialog materialDialog){
      triggerStorageAccessFramework();
    }
    @Override public void onNegative(    MaterialDialog materialDialog){
      Toast.makeText(mainActivity,R.string.error,Toast.LENGTH_SHORT).show();
    }
  }
);
  final MaterialDialog y=x.build();
  y.show();
}

Fixed version (ground truth):
public void guideDialogForLEXA(String path){
  final MaterialDialog.Builder x=new MaterialDialog.Builder(mainActivity);
  x.theme(mainActivity.getAppTheme().getMaterialDialogTheme());
  x.title(R.string.needsaccess);
  LayoutInflater layoutInflater=(LayoutInflater)mainActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View view=layoutInflater.inflate(R.layout.lexadrawer,null);
  x.customView(view,true);
  TextView textView=view.findViewById(R.id.description);
  textView.setText(mainActivity.getString(R.string.needsaccesssummary) + path + mainActivity.getString(R.string.needsaccesssummary1));
  ((ImageView)view.findViewById(R.id.icon)).setImageResource(R.drawable.sd_operate_step);
  x.positiveText(R.string.open).negativeText(R.string.cancel).positiveColor(accentColor).negativeColor(accentColor).onPositive((dialog,which) -> triggerStorageAccessFramework()).onNegative((dialog,which) -> Toast.makeText(mainActivity,R.string.error,Toast.LENGTH_SHORT).show());
  final MaterialDialog y=x.build();
  y.show();
}
Program: 162433
Project: 162433
Buggy source:
void copyRoot(HybridFileParcelable sourceFile,HybridFile targetFile,boolean move){
  try {
    if (!move)     RootUtils.copy(sourceFile.getPath(),targetFile.getPath());
 else     if (move)     RootUtils.move(sourceFile.getPath(),targetFile.getPath());
    ServiceWatcherUtil.position+=sourceFile.getSize();
  }
 catch (  ShellNotRunningException e) {
    failedFOps.add(sourceFile);
    e.printStackTrace();
  }
  FileUtils.scanFile(targetFile.getPath(),c);
}

Fixed version (ground truth):
void copyRoot(HybridFileParcelable sourceFile,HybridFile targetFile,boolean move){
  try {
    if (!move)     RootUtils.copy(sourceFile.getPath(),targetFile.getPath());
 else     if (move)     RootUtils.move(sourceFile.getPath(),targetFile.getPath());
    ServiceWatcherUtil.position+=sourceFile.getSize();
  }
 catch (  ShellNotRunningException e) {
    failedFOps.add(sourceFile);
    e.printStackTrace();
  }
  FileUtils.scanFile(targetFile.getFile(),c);
}
Program: 162434
Project: 162434
Buggy source:
public void hide(String path){
  dataUtils.addHiddenFile(path);
  if (new File(path).isDirectory()) {
    File f1=new File(path + "String_Node_Str" + "String_Node_Str");
    if (!f1.exists()) {
      try {
        getMainActivity().mainActivityHelper.mkFile(new HybridFile(OpenMode.FILE,f1.getPath()),this);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
    FileUtils.scanFile(path,getActivity());
  }
}

Fixed version (ground truth):
public void hide(String path){
  dataUtils.addHiddenFile(path);
  File file=new File(path);
  if (file.isDirectory()) {
    File f1=new File(path + "String_Node_Str" + "String_Node_Str");
    if (!f1.exists()) {
      try {
        getMainActivity().mainActivityHelper.mkFile(new HybridFile(OpenMode.FILE,f1.getPath()),this);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
    FileUtils.scanFile(file,getActivity());
  }
}