nus-yam/ex-repair huggingface dataset:
Program: 92692
Project: 92692
Buggy source:
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  float lineHeight=pText.getFontSpacing();
  rect.set(0,0,nColumns * columnWidth,columnHeight);
  rect.offset(0,headerHeight);
  drawGrid(canvas,rect);
  String previousMonth="String_Node_Str";
  pGraph.setColor(primaryColor);
  prevRect.setEmpty();
  long currentDate=DateHelper.getStartOfToday();
  for (int k=0; k < nColumns + dataOffset - 1; k++)   currentDate-=7 * DateHelper.millisecondsInOneDay;
  for (int k=0; k < nColumns; k++) {
    String month=dfMonth.format(currentDate);
    String day=dfDay.format(currentDate);
    int score=0;
    int offset=nColumns - k - 1 + dataOffset;
    if (offset < scores.length)     score=scores[offset];
    double sRelative=((double)score) / Habit.MAX_SCORE;
    int height=(int)(columnHeight * sRelative);
    rect.set(0,0,columnWidth,columnWidth);
    rect.offset(k * columnWidth,headerHeight + columnHeight - height - columnWidth / 2);
    if (!prevRect.isEmpty()) {
      drawLine(canvas,prevRect,rect);
      drawMarker(canvas,prevRect);
    }
    if (k == nColumns - 1)     drawMarker(canvas,rect);
    prevRect.set(rect);
    rect.set(0,0,columnWidth,columnHeight);
    rect.offset(k * columnWidth,headerHeight);
    if (!month.equals(previousMonth))     canvas.drawText(month,rect.centerX(),rect.bottom + lineHeight * 1.2f,pText);
 else     canvas.drawText(day,rect.centerX(),rect.bottom + lineHeight * 1.2f,pText);
    previousMonth=month;
    currentDate+=7 * DateHelper.millisecondsInOneDay;
  }
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  float lineHeight=pText.getFontSpacing();
  rect.set(0,0,nColumns * columnWidth,columnHeight);
  drawGrid(canvas,rect);
  String previousMonth="String_Node_Str";
  pGraph.setColor(primaryColor);
  prevRect.setEmpty();
  long currentDate=DateHelper.getStartOfToday();
  for (int k=0; k < nColumns + getDataOffset() - 1; k++)   currentDate-=7 * DateHelper.millisecondsInOneDay;
  for (int k=0; k < nColumns; k++) {
    String month=dfMonth.format(currentDate);
    String day=dfDay.format(currentDate);
    int score=0;
    int offset=nColumns - k - 1 + getDataOffset();
    if (offset < scores.length)     score=scores[offset];
    double sRelative=((double)score) / Habit.MAX_SCORE;
    int height=(int)(columnHeight * sRelative);
    rect.set(0,0,baseSize,baseSize);
    rect.offset(k * columnWidth,columnHeight - height - columnWidth / 2);
    if (!prevRect.isEmpty()) {
      drawLine(canvas,prevRect,rect);
      drawMarker(canvas,prevRect);
    }
    if (k == nColumns - 1)     drawMarker(canvas,rect);
    prevRect.set(rect);
    rect.set(0,0,columnWidth,columnHeight);
    rect.offset(k * columnWidth,0);
    if (!month.equals(previousMonth))     canvas.drawText(month,rect.centerX(),rect.bottom + lineHeight * 1.2f,pText);
 else     canvas.drawText(day,rect.centerX(),rect.bottom + lineHeight * 1.2f,pText);
    previousMonth=month;
    currentDate+=7 * DateHelper.millisecondsInOneDay;
  }
}
Program: 92693
Project: 92693
Buggy source:
private void drawMarker(Canvas canvas,RectF rect){
  rect.inset(columnWidth * 0.15f,columnWidth * 0.15f);
  pGraph.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
  canvas.drawOval(rect,pGraph);
  rect.inset(columnWidth * 0.1f,columnWidth * 0.1f);
  pGraph.setColor(primaryColor);
  pGraph.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
  canvas.drawOval(rect,pGraph);
  rect.inset(columnWidth * 0.1f,columnWidth * 0.1f);
  pGraph.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
  canvas.drawOval(rect,pGraph);
  pGraph.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
}

Fixed version (ground truth):
private void drawMarker(Canvas canvas,RectF rect){
  rect.inset(columnWidth * 0.15f,columnWidth * 0.15f);
  setModeOrColor(pGraph,XFERMODE_CLEAR,Color.WHITE);
  canvas.drawOval(rect,pGraph);
  rect.inset(columnWidth * 0.1f,columnWidth * 0.1f);
  setModeOrColor(pGraph,XFERMODE_SRC,primaryColor);
  canvas.drawOval(rect,pGraph);
  rect.inset(columnWidth * 0.1f,columnWidth * 0.1f);
  setModeOrColor(pGraph,XFERMODE_CLEAR,Color.WHITE);
  canvas.drawOval(rect,pGraph);
  if (isBackgroundTransparent)   pGraph.setXfermode(XFERMODE_SRC);
}
Program: 92694
Project: 92694
Buggy source:
private void init(){
  setDimensions(baseSize);
  createPaints();
  createColors();
  dfMonth=new SimpleDateFormat("String_Node_Str",Locale.getDefault());
  rect=new Rect();
}

Fixed version (ground truth):
private void init(){
  createPaints();
  createColors();
  dfMonth=new SimpleDateFormat("String_Node_Str",Locale.getDefault());
  rect=new Rect();
}
Program: 92695
Project: 92695
Buggy source:
public HabitStreakView(Context context,AttributeSet attrs){
  super(context,attrs);
  this.baseSize=(int)context.getResources().getDimension(R.dimen.small_square_size);
  this.primaryColor=ColorHelper.palette[7];
  init();
}

Fixed version (ground truth):
public HabitStreakView(Context context,AttributeSet attrs){
  super(context,attrs);
  this.primaryColor=ColorHelper.palette[7];
  init();
}
Program: 92696
Project: 92696
Buggy source:
protected void createPaints(){
  pText=new Paint();
  pText.setColor(Color.LTGRAY);
  pText.setTextAlign(Paint.Align.CENTER);
  pText.setTextSize(columnWidth * 0.5f);
  pText.setAntiAlias(true);
  pBar=new Paint();
  pBar.setTextAlign(Paint.Align.CENTER);
  pBar.setTextSize(columnWidth * 0.5f);
  pBar.setAntiAlias(true);
}

Fixed version (ground truth):
protected void createPaints(){
  pText=new Paint();
  pText.setColor(Color.LTGRAY);
  pText.setTextAlign(Paint.Align.CENTER);
  pText.setAntiAlias(true);
  pBar=new Paint();
  pBar.setTextAlign(Paint.Align.CENTER);
  pBar.setAntiAlias(true);
}
Program: 92697
Project: 92697
Buggy source:
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  float lineHeight=pText.getFontSpacing();
  float barHeaderOffset=lineHeight * 0.4f;
  int nStreaks=startTimes.length;
  int start=nStreaks - nColumns - dataOffset;
  String previousMonth="String_Node_Str";
  for (int offset=0; offset < nColumns && start + offset < nStreaks; offset++) {
    if (start + offset < 0)     continue;
    String month=dfMonth.format(startTimes[start + offset]);
    long l=lengths[offset + start];
    double lRelative=((double)l) / maxStreakLength;
    pBar.setColor(colors[(int)Math.floor(lRelative * 3)]);
    int height=(int)(columnHeight * lRelative);
    rect.set(0,0,columnWidth - 2,height);
    rect.offset(offset * columnWidth,headerHeight + columnHeight - height);
    canvas.drawRect(rect,pBar);
    canvas.drawText(Long.toString(l),rect.centerX(),rect.top - barHeaderOffset,pBar);
    if (!month.equals(previousMonth))     canvas.drawText(month,rect.centerX(),rect.bottom + lineHeight * 1.2f,pText);
    previousMonth=month;
  }
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  float lineHeight=pText.getFontSpacing();
  float barHeaderOffset=lineHeight * 0.4f;
  int nStreaks=startTimes.length;
  int start=nStreaks - nColumns - getDataOffset();
  String previousMonth="String_Node_Str";
  for (int offset=0; offset < nColumns && start + offset < nStreaks; offset++) {
    if (start + offset < 0)     continue;
    String month=dfMonth.format(startTimes[start + offset]);
    long l=lengths[offset + start];
    double lRelative=((double)l) / maxStreakLength;
    pBar.setColor(colors[(int)Math.floor(lRelative * 3)]);
    int height=(int)(columnHeight * lRelative);
    rect.set(0,0,columnWidth - 2,height);
    rect.offset(offset * columnWidth,headerHeight + columnHeight - height);
    canvas.drawRect(rect,pBar);
    canvas.drawText(Long.toString(l),rect.centerX(),rect.top - barHeaderOffset,pBar);
    if (!month.equals(previousMonth))     canvas.drawText(month,rect.centerX(),rect.bottom + lineHeight * 1.2f,pText);
    previousMonth=month;
  }
}
Program: 92699
Project: 92699
Buggy source:
public int[] getReps(long timeFrom,long timeTo){
  long timeFromExtended=timeFrom - freq_den * DateHelper.millisecondsInOneDay;
  List<Repetition> reps=selectRepsFromTo(timeFromExtended,timeTo).execute();
  int nDaysExtended=(int)((timeTo - timeFromExtended) / DateHelper.millisecondsInOneDay);
  int checkExtended[]=new int[nDaysExtended + 1];
  int nDays=(int)((timeTo - timeFrom) / DateHelper.millisecondsInOneDay);
  for (  Repetition rep : reps) {
    int offset=(int)((rep.timestamp - timeFrom) / DateHelper.millisecondsInOneDay);
    checkExtended[nDays - offset]=2;
  }
  for (int i=0; i < nDays; i++) {
    int counter=0;
    for (int j=0; j < freq_den; j++)     if (checkExtended[i + j] == 2)     counter++;
    if (counter >= freq_num)     checkExtended[i]=Math.max(checkExtended[i],1);
  }
  int check[]=new int[nDays + 1];
  for (int i=0; i < nDays + 1; i++)   check[i]=checkExtended[i];
  return check;
}

Fixed version (ground truth):
public int[] getReps(long timeFrom,long timeTo){
  long timeFromExtended=timeFrom - (long)(freq_den) * DateHelper.millisecondsInOneDay;
  List<Repetition> reps=selectRepsFromTo(timeFromExtended,timeTo).execute();
  int nDaysExtended=(int)((timeTo - timeFromExtended) / DateHelper.millisecondsInOneDay);
  int checkExtended[]=new int[nDaysExtended + 1];
  int nDays=(int)((timeTo - timeFrom) / DateHelper.millisecondsInOneDay);
  for (  Repetition rep : reps) {
    int offset=(int)((rep.timestamp - timeFrom) / DateHelper.millisecondsInOneDay);
    checkExtended[nDays - offset]=2;
  }
  for (int i=0; i < nDays; i++) {
    int counter=0;
    for (int j=0; j < freq_den; j++)     if (checkExtended[i + j] == 2)     counter++;
    if (counter >= freq_num)     checkExtended[i]=Math.max(checkExtended[i],1);
  }
  int check[]=new int[nDays + 1];
  for (int i=0; i < nDays + 1; i++)   check[i]=checkExtended[i];
  return check;
}
Program: 92700
Project: 92700
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  presenter=PresenterManager.getInstance().provide(this,savedInstanceState == null ? null : savedInstanceState.getBundle(PRESENTER_STATE_KEY));
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestPresenter(savedInstanceState == null ? null : savedInstanceState.getBundle(PRESENTER_STATE_KEY));
}
Program: 92701
Project: 92701
Buggy source:
@Override protected void onDestroy(){
  if (isFinishing()) {
    PresenterManager.getInstance().destroy(presenter);
    presenter=null;
  }
  super.onDestroy();
}

Fixed version (ground truth):
@Override protected void onDestroy(){
  if (isFinishing())   destroyPresenter();
  super.onDestroy();
}
Program: 92702
Project: 92702
Buggy source:
@Override protected void onSaveInstanceState(@NonNull Bundle outState){
  super.onSaveInstanceState(outState);
  outState.putBundle(PRESENTER_STATE_KEY,PresenterManager.getInstance().save(presenter));
}

Fixed version (ground truth):
@Override protected void onSaveInstanceState(@NonNull Bundle outState){
  super.onSaveInstanceState(outState);
  outState.putBundle(PRESENTER_STATE_KEY,savePresenter());
}
Program: 92703
Project: 92703
Buggy source:
@Override protected void onPause(){
  super.onPause();
  presenter.dropView();
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
  dropView(this);
}
Program: 92704
Project: 92704
Buggy source:
@Override protected void onResume(){
  super.onResume();
  presenter.takeView(this);
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  takeView();
}
Program: 92705
Project: 92705
Buggy source:
@Override public void onCreate(Bundle bundle){
  super.onCreate(bundle);
  presenter=PresenterManager.getInstance().provide(this,bundle == null ? null : bundle.getBundle(PRESENTER_STATE_KEY));
}

Fixed version (ground truth):
@Override public void onCreate(Bundle bundle){
  super.onCreate(bundle);
  requestPresenter(bundle == null ? null : bundle.getBundle(PRESENTER_STATE_KEY));
}
Program: 92706
Project: 92706
Buggy source:
/** 
 * Destroys a presenter that is currently attached to the view. Use this method if you set   {@link #setOnDropViewAction(OnDropViewAction)} to{@link OnDropViewAction#NONE}.
 */
public void destroyPresenter(){
  if (presenter != null) {
    presenter.destroy();
    presenter=null;
  }
}

Fixed version (ground truth):
/** 
 * Destroys a presenter that is currently attached to the View.
 */
public void destroyPresenter(){
  if (presenter != null) {
    PresenterManager.getInstance().destroy(presenter);
    presenter=null;
  }
}
Program: 92707
Project: 92707
Buggy source:
@Override public void onPause(){
  super.onPause();
  presenter.dropView();
  if (onDropViewAction == OnDropViewAction.DESTROY_PRESENTER || (onDropViewAction == OnDropViewAction.DESTROY_PRESENTER_IF_FINISHING && getActivity().isFinishing()))   destroyPresenter();
}

Fixed version (ground truth):
@Override public void onPause(){
  super.onPause();
  dropView(getActivity());
}
Program: 92708
Project: 92708
Buggy source:
@Override public void onSaveInstanceState(Bundle bundle){
  super.onSaveInstanceState(bundle);
  bundle.putBundle(PRESENTER_STATE_KEY,PresenterManager.getInstance().save(presenter));
}

Fixed version (ground truth):
@Override public void onSaveInstanceState(Bundle bundle){
  super.onSaveInstanceState(bundle);
  bundle.putBundle(PRESENTER_STATE_KEY,savePresenter());
}
Program: 92709
Project: 92709
Buggy source:
/** 
 * Returns a current attached presenter. This method is guaranteed to return a non-null value between onAttachedToWindow/onDetachedFromWindow calls.
 * @return a current attached presenter or null.
 */
public PresenterType getPresenter(){
  return presenter;
}

Fixed version (ground truth):
/** 
 * Returns a current attached presenter. This method is guaranteed to return a non-null value between onResume/onPause calls.
 * @return a current attached presenter or null.
 */
public PresenterType getPresenter(){
  return presenter;
}
Program: 92710
Project: 92710
Buggy source:
@Override public void onResume(){
  super.onResume();
  if (presenter == null)   presenter=PresenterManager.getInstance().provide(this,null);
  presenter.takeView(this);
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  takeView();
}
Program: 92711
Project: 92711
Buggy source:
@Override protected void onRestoreInstanceState(Parcelable state){
  Bundle bundle=(Bundle)state;
  super.onRestoreInstanceState(bundle.getParcelable(PARENT_STATE_KEY));
  presenter=PresenterManager.getInstance().provide(this,bundle.getBundle(PRESENTER_STATE_KEY));
}

Fixed version (ground truth):
@Override protected void onRestoreInstanceState(Parcelable state){
  Bundle bundle=(Bundle)state;
  super.onRestoreInstanceState(bundle.getParcelable(PARENT_STATE_KEY));
  requestPresenter(bundle.getBundle(PRESENTER_STATE_KEY));
}
Program: 92712
Project: 92712
Buggy source:
/** 
 * Destroys a presenter that is currently attached to the view. Use this method if you set   {@link #setOnDropViewAction(OnDropViewAction)} to{@link OnDropViewAction#NONE}.
 */
public void destroyPresenter(){
  if (presenter != null) {
    presenter.destroy();
    presenter=null;
  }
}

Fixed version (ground truth):
/** 
 * Destroys a presenter that is currently attached to the view.
 */
public void destroyPresenter(){
  if (presenter != null) {
    PresenterManager.getInstance().destroy(presenter);
    presenter=null;
  }
}
Program: 92713
Project: 92713
Buggy source:
@Override protected Parcelable onSaveInstanceState(){
  Bundle bundle=new Bundle();
  bundle.putBundle(PRESENTER_STATE_KEY,PresenterManager.getInstance().save(presenter));
  bundle.putParcelable(PARENT_STATE_KEY,super.onSaveInstanceState());
  return bundle;
}

Fixed version (ground truth):
@Override protected Parcelable onSaveInstanceState(){
  Bundle bundle=new Bundle();
  bundle.putBundle(PRESENTER_STATE_KEY,savePresenter());
  bundle.putParcelable(PARENT_STATE_KEY,super.onSaveInstanceState());
  return bundle;
}
Program: 92714
Project: 92714
Buggy source:
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  presenter.dropView();
  if (onDropViewAction == OnDropViewAction.DESTROY_PRESENTER || (onDropViewAction == OnDropViewAction.DESTROY_PRESENTER_IF_FINISHING && activity.isFinishing()))   destroyPresenter();
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  dropView(activity);
}
Program: 92715
Project: 92715
Buggy source:
@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  if (!isInEditMode()) {
    activity=(Activity)getContext();
    if (presenter == null)     presenter=PresenterManager.getInstance().provide(this,null);
    presenter.takeView(this);
  }
}

Fixed version (ground truth):
@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  if (!isInEditMode()) {
    activity=(Activity)getContext();
    takeView();
  }
}
Program: 92716
Project: 92716
Buggy source:
public void setFloatOffset(int x){
  mOffset=x;
  int centerDiffX=mMarker.getMeasuredWidth() / 2;
  int offset=(x - centerDiffX);
  mMarker.offsetLeftAndRight(offset - mMarker.getLeft());
  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
    invalidate();
  }
}

Fixed version (ground truth):
public void setFloatOffset(int x){
  mOffset=x;
  int centerDiffX=mMarker.getMeasuredWidth() / 2;
  int offset=(x - centerDiffX);
  mMarker.offsetLeftAndRight(offset - mMarker.getLeft());
  if (!SeekBarCompat.isHardwareAccelerated(this)) {
    invalidate();
  }
}
Program: 92717
Project: 92717
Buggy source:
public AlmostRippleDrawable(@NonNull ColorStateList tintStateList){
  super(tintStateList);
  mInterpolator=new AccelerateDecelerateInterpolator();
  mFocusedColor=tintStateList.getColorForState(new int[]{android.R.attr.state_focused},0xFFFF0000);
  mPressedColor=tintStateList.getColorForState(new int[]{android.R.attr.state_pressed},0xFFFF0000);
  mDisabledColor=tintStateList.getColorForState(new int[]{-android.R.attr.state_enabled},0xFFFF0000);
}

Fixed version (ground truth):
public AlmostRippleDrawable(@NonNull ColorStateList tintStateList){
  super(tintStateList);
  int defaultColor=tintStateList.getDefaultColor();
  mInterpolator=new AccelerateDecelerateInterpolator();
  mFocusedColor=tintStateList.getColorForState(new int[]{android.R.attr.state_enabled,android.R.attr.state_focused},defaultColor);
  mPressedColor=tintStateList.getColorForState(new int[]{android.R.attr.state_enabled,android.R.attr.state_pressed},defaultColor);
  mDisabledColor=tintStateList.getColorForState(new int[]{-android.R.attr.state_enabled},defaultColor);
  mFocusedColor=getModulatedAlphaColor(130,mFocusedColor);
  mPressedColor=getModulatedAlphaColor(130,mPressedColor);
  mDisabledColor=getModulatedAlphaColor(130,mDisabledColor);
}
Program: 92718
Project: 92718
Buggy source:
public MarkerDrawable(@NonNull ColorStateList tintList,int closedSize){
  super(tintList);
  mInterpolator=new AccelerateDecelerateInterpolator();
  mClosedStateSize=closedSize;
  mStartColor=tintList.getColorForState(new int[]{android.R.attr.state_pressed},tintList.getDefaultColor());
  mEndColor=tintList.getDefaultColor();
}

Fixed version (ground truth):
public MarkerDrawable(@NonNull ColorStateList tintList,int closedSize){
  super(tintList);
  mInterpolator=new AccelerateDecelerateInterpolator();
  mClosedStateSize=closedSize;
  mStartColor=tintList.getColorForState(new int[]{android.R.attr.state_enabled,android.R.attr.state_pressed},tintList.getDefaultColor());
  mEndColor=tintList.getDefaultColor();
}
Program: 92719
Project: 92719
Buggy source:
public PopupIndicator(Context context,AttributeSet attrs,int defStyleAttr,String maxValue,int thumbSize,int separation){
  mWindowManager=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  mPopupView=new Floater(context,attrs,defStyleAttr,maxValue,thumbSize,separation);
  DisplayMetrics displayMetrics=context.getResources().getDisplayMetrics();
  screenSize.set(displayMetrics.widthPixels,displayMetrics.heightPixels);
}

Fixed version (ground truth):
public PopupIndicator(Context context,AttributeSet attrs,int defStyleAttr,String maxValue,int thumbSize,int separation){
  mWindowManager=(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
  mPopupView=new Floater(context,attrs,defStyleAttr,maxValue,thumbSize,separation);
}
Program: 92720
Project: 92720
Buggy source:
private void updateLayoutParamsForPosiion(View anchor,WindowManager.LayoutParams p,int yOffset){
  measureFloater();
  int measuredHeight=mPopupView.getMeasuredHeight();
  int paddingBottom=mPopupView.mMarker.getPaddingBottom();
  anchor.getLocationInWindow(mDrawingLocation);
  p.x=0;
  p.y=mDrawingLocation[1] - measuredHeight + yOffset + paddingBottom;
  p.width=screenSize.x;
  p.height=measuredHeight;
}

Fixed version (ground truth):
private void updateLayoutParamsForPosiion(View anchor,WindowManager.LayoutParams p,int yOffset){
  DisplayMetrics displayMetrics=anchor.getResources().getDisplayMetrics();
  screenSize.set(displayMetrics.widthPixels,displayMetrics.heightPixels);
  measureFloater();
  int measuredHeight=mPopupView.getMeasuredHeight();
  int paddingBottom=mPopupView.mMarker.getPaddingBottom();
  anchor.getLocationInWindow(mDrawingLocation);
  p.x=0;
  p.y=mDrawingLocation[1] - measuredHeight + yOffset + paddingBottom;
  p.width=screenSize.x;
  p.height=measuredHeight;
}
Program: 92721
Project: 92721
Buggy source:
/** 
 * Sets the maximum value for this DiscreteSeekBar if the supplied argument is smaller than the Current MIN value, the MIN value will be set to MAX-1 <p/> <p> Also if the current progress is out of the new range, it will be set to MIN </p>
 * @param max
 * @see #setMin(int)
 * @see #setProgress(int)
 */
public void setMax(int max){
  mMax=max;
  if (mMax < mMin) {
    setMin(mMax - 1);
  }
  updateKeyboardRange();
  if (mValue < mMin || mValue > mMax) {
    setProgress(mMin);
  }
}

Fixed version (ground truth):
/** 
 * Sets the maximum value for this DiscreteSeekBar if the supplied argument is smaller than the Current MIN value, the MIN value will be set to MAX-1 <p/> <p> Also if the current progress is out of the new range, it will be set to MIN </p>
 * @param max
 * @see #setMin(int)
 * @see #setProgress(int)
 */
public void setMax(int max){
  mMax=max;
  if (mMax < mMin) {
    setMin(mMax - 1);
  }
  updateKeyboardRange();
  if (mValue < mMin || mValue > mMax) {
    setProgress(mMin);
  }
  updateIndicatorSizes();
}
Program: 92722
Project: 92722
Buggy source:
/** 
 * Sets the current   {@link DiscreteSeekBar.NumericTransformer}
 * @param transformer
 * @see #getNumericTransformer()
 */
public void setNumericTransformer(@Nullable NumericTransformer transformer){
  mNumericTransformer=transformer != null ? transformer : new DefaultNumericTransformer();
  if (!isInEditMode()) {
    if (mNumericTransformer.useStringTransform()) {
      mIndicator.updateSizes(mNumericTransformer.transformToString(mMax));
    }
 else {
      mIndicator.updateSizes(convertValueToMessage(mNumericTransformer.transform(mMax)));
    }
  }
  updateProgressMessage(mValue);
}

Fixed version (ground truth):
/** 
 * Sets the current   {@link DiscreteSeekBar.NumericTransformer}
 * @param transformer
 * @see #getNumericTransformer()
 */
public void setNumericTransformer(@Nullable NumericTransformer transformer){
  mNumericTransformer=transformer != null ? transformer : new DefaultNumericTransformer();
  updateIndicatorSizes();
  updateProgressMessage(mValue);
}
Program: 92723
Project: 92723
Buggy source:
@Override public void offsetTopAndBottom(int offset){
  mTop+=offset;
  mOffsetTop+=offset;
  float offsetTop=mOffsetTop - dp2px(20);
  if (offsetTop < 1) {
    mAngle=0;
    return;
  }
  int finalOffset=getRefreshLayout().getFinalOffset() - dp2px(20);
  if (offsetTop > finalOffset) {
    offsetTop=finalOffset;
  }
  mAngle=340 * (offsetTop / finalOffset);
  invalidateSelf();
}

Fixed version (ground truth):
@Override public void offsetTopAndBottom(int offset){
  mTop+=offset;
  mOffsetTop+=offset;
  float offsetTop=mOffsetTop - dp2px(20);
  if (offsetTop <= 0) {
    mAngle=0;
  }
 else {
    int finalOffset=getRefreshLayout().getFinalOffset() - dp2px(20);
    if (offsetTop > finalOffset) {
      offsetTop=finalOffset;
    }
    mAngle=340 * (offsetTop / finalOffset);
  }
  invalidateSelf();
}
Program: 92724
Project: 92724
Buggy source:
private void updateBounds(){
  int height=mHeight;
  int width=mWidth;
  if (height > getRefreshLayout().getFinalOffset()) {
    height=getRefreshLayout().getFinalOffset();
  }
  float precent=height / (float)getRefreshLayout().getFinalOffset();
  int offsetX=(int)(width / 2 * precent);
  int offsetY=0;
  p1.set(offsetX,offsetY);
  p2.set(width - offsetX,offsetY);
  p3.set(width / 2 - height,height);
  p4.set(width / 2 + height,height);
}

Fixed version (ground truth):
private void updateBounds(){
  int height=mHeight;
  int width=mWidth;
  if (height > getRefreshLayout().getFinalOffset()) {
    height=getRefreshLayout().getFinalOffset();
  }
  final float percent=height / (float)getRefreshLayout().getFinalOffset();
  int offsetX=(int)(width / 2 * percent);
  int offsetY=0;
  p1.set(offsetX,offsetY);
  p2.set(width - offsetX,offsetY);
  p3.set(width / 2 - height,height);
  p4.set(width / 2 + height,height);
}
Program: 92726
Project: 92726
Buggy source:
public MaterialSubheader(Context ctx){
  float density=ctx.getResources().getDisplayMetrics().density;
  LinearLayout layout=new LinearLayout(ctx);
  layout.setOrientation(LinearLayout.VERTICAL);
  View view=new View(ctx);
  view.setBackgroundColor(Color.parseColor("String_Node_Str"));
  LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,1);
  params.setMargins(0,(int)(8 * density),0,(int)(8 * density));
  layout.addView(view,params);
  text=new TextView(ctx);
  Utils.setAlpha(text,0.54f);
  text.setTextSize(TypedValue.COMPLEX_UNIT_SP,14);
  text.setGravity(Gravity.START);
  LinearLayout.LayoutParams paramsText=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT);
  paramsText.setMargins((int)(16 * density),0,(int)(16 * density),(int)(4 * density));
  layout.addView(text,paramsText);
  this.view=layout;
  Resources.Theme theme=ctx.getTheme();
  TypedValue typedValue=new TypedValue();
  theme.resolveAttribute(R.attr.sectionStyle,typedValue,true);
  TypedArray values=theme.obtainStyledAttributes(typedValue.resourceId,R.styleable.MaterialSection);
  try {
    titleColor=values.getColor(R.styleable.MaterialSubheader_subheaderTitleColor,0x000);
  }
  finally {
    values.recycle();
  }
  text.setTextColor(Color.BLACK);
}

Fixed version (ground truth):
public MaterialSubheader(Context ctx){
  float density=ctx.getResources().getDisplayMetrics().density;
  LinearLayout layout=new LinearLayout(ctx);
  layout.setOrientation(LinearLayout.VERTICAL);
  View view=new View(ctx);
  view.setBackgroundColor(Color.parseColor("String_Node_Str"));
  LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,1);
  params.setMargins(0,(int)(8 * density),0,(int)(8 * density));
  layout.addView(view,params);
  text=new TextView(ctx);
  Utils.setAlpha(text,0.54f);
  text.setTextSize(TypedValue.COMPLEX_UNIT_SP,14);
  text.setGravity(Gravity.START);
  LinearLayout.LayoutParams paramsText=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT);
  paramsText.setMargins((int)(16 * density),0,(int)(16 * density),(int)(4 * density));
  layout.addView(text,paramsText);
  this.view=layout;
  Resources.Theme theme=ctx.getTheme();
  TypedValue typedValue=new TypedValue();
  theme.resolveAttribute(R.attr.subheaderStyle,typedValue,true);
  TypedArray values=theme.obtainStyledAttributes(typedValue.resourceId,R.styleable.MaterialSubheader);
  try {
    titleColor=values.getColor(R.styleable.MaterialSubheader_subheaderTitleColor,0x000);
  }
  finally {
    values.recycle();
  }
  text.setTextColor(titleColor);
}
Program: 92727
Project: 92727
Buggy source:
public static int getDrawerWidth(Resources res){
  if (res.getConfiguration().smallestScreenWidthDp >= 600 || res.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
    return (int)(320 * res.getDisplayMetrics().density);
  }
 else {
    return (int)(res.getDisplayMetrics().widthPixels - (56 * res.getDisplayMetrics().density));
  }
}

Fixed version (ground truth):
public static int getDrawerWidth(Resources res){
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
    if (res.getConfiguration().smallestScreenWidthDp >= 600 || res.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
      return (int)(320 * res.getDisplayMetrics().density);
    }
 else {
      return (int)(res.getDisplayMetrics().widthPixels - (56 * res.getDisplayMetrics().density));
    }
  }
 else {
    if ((res.getDisplayMetrics().widthPixels / res.getDisplayMetrics().density) >= 600 || res.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)     return (int)(320 * res.getDisplayMetrics().density);
 else     return (int)(res.getDisplayMetrics().widthPixels - (56 * res.getDisplayMetrics().density));
  }
}
Program: 92728
Project: 92728
Buggy source:
public static boolean isTablet(Resources res){
  return res.getConfiguration().smallestScreenWidthDp >= 600;
}

Fixed version (ground truth):
public static boolean isTablet(Resources res){
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
    return res.getConfiguration().smallestScreenWidthDp >= 600;
  }
 else {
    return (res.getDisplayMetrics().widthPixels / res.getDisplayMetrics().density) >= 600;
  }
}
Program: 92729
Project: 92729
Buggy source:
public Bitmap getPhoto(){
  return photo;
}

Fixed version (ground truth):
public Drawable getPhoto(){
  return photo;
}
Program: 92730
Project: 92730
Buggy source:
public MaterialAccount(String title,String subTitle,Bitmap photo,Bitmap background){
  this.photo=photo;
  this.title=title;
  this.subTitle=subTitle;
  this.background=background;
}

Fixed version (ground truth):
public MaterialAccount(Resources res,String title,String subTitle,Bitmap photo,Bitmap background){
  this.photo=new BitmapDrawable(res,photo);
  this.title=title;
  this.subTitle=subTitle;
  this.background=new BitmapDrawable(res,background);
  resources=res;
}
Program: 92731
Project: 92731
Buggy source:
public void setBackground(Drawable background){
  this.background=convertToBitmap(background);
}

Fixed version (ground truth):
public void setBackground(Drawable background){
  this.background=background;
}
Program: 92732
Project: 92732
Buggy source:
public Bitmap getCircularPhoto(){
  return getCroppedBitmap(photo);
}

Fixed version (ground truth):
public Drawable getCircularPhoto(){
  if (circularPhoto != null) {
    return circularPhoto;
  }
  circularPhoto=getCroppedBitmapDrawable(photo);
  return circularPhoto;
}
Program: 92733
Project: 92733
Buggy source:
public void setPhoto(Bitmap photo){
  this.photo=photo;
}

Fixed version (ground truth):
public void setPhoto(Resources res,Bitmap photo){
  this.photo=new BitmapDrawable(res,photo);
}
Program: 92734
Project: 92734
Buggy source:
public Bitmap getBackground(){
  return background;
}

Fixed version (ground truth):
public Drawable getBackground(){
  return background;
}
Program: 92735
Project: 92735
Buggy source:
private void setSecondAccountPhoto(Bitmap photo){
  userSecondPhoto.setImageBitmap(photo);
}

Fixed version (ground truth):
private void setSecondAccountPhoto(Drawable photo){
  userSecondPhoto.setImageDrawable(photo);
}
Program: 92736
Project: 92736
Buggy source:
@Override protected void attachBaseContext(Context newBase){
  super.attachBaseContext(new CalligraphyContextWrapper(newBase,R.attr.neokree_fontPath));
}

Fixed version (ground truth):
@Override protected void attachBaseContext(Context newBase){
  super.attachBaseContext(new CalligraphyContextWrapper(newBase,R.attr.fontPath));
}
Program: 92738
Project: 92738
Buggy source:
private void setFirstAccountPhoto(Bitmap photo){
  userphoto.setImageBitmap(photo);
}

Fixed version (ground truth):
private void setFirstAccountPhoto(Drawable photo){
  userphoto.setImageDrawable(photo);
}
Program: 92739
Project: 92739
Buggy source:
private void setThirdAccountPhoto(Bitmap photo){
  userThirdPhoto.setImageBitmap(photo);
}

Fixed version (ground truth):
private void setThirdAccountPhoto(Drawable photo){
  userThirdPhoto.setImageDrawable(photo);
}
Program: 92740
Project: 92740
Buggy source:
private void setDrawerBackground(Bitmap background){
  usercover.setImageBitmap(background);
}

Fixed version (ground truth):
private void setDrawerBackground(Drawable background){
  usercover.setImageDrawable(background);
}
Program: 92742
Project: 92742
Buggy source:
@Override public void onClick(MaterialSection section){
switch (section.getTarget()) {
case MaterialSection.TARGET_FRAGMENT:
    setFragment((Fragment)section.getTargetFragment(),section.getTitle(),(Fragment)currentSection.getTargetFragment());
  changeToolbarColor(section);
if (!isCurrentFragmentChild) {
  childFragmentStack.remove(childFragmentStack.size() - 1);
  childTitleStack.remove(childTitleStack.size() - 1);
}
 else for (int i=childFragmentStack.size() - 1; i >= 0; i--) {
  childFragmentStack.remove(i);
  childTitleStack.remove(i);
}
childFragmentStack.add((Fragment)section.getTargetFragment());
childTitleStack.add(section.getTitle());
isCurrentFragmentChild=false;
pulsante.setDrawerIndicatorEnabled(true);
break;
case MaterialSection.TARGET_ACTIVITY:
this.startActivity(section.getTargetIntent());
if (!deviceSupportMultiPane()) layout.closeDrawer(drawer);
break;
case MaterialSection.TARGET_LISTENER:
if (!deviceSupportMultiPane()) layout.closeDrawer(drawer);
default :
break;
}
currentSection=section;
int position=section.getPosition();
for (MaterialSection mySection : sectionList) {
if (position != mySection.getPosition()) mySection.unSelect();
}
for (MaterialSection mySection : bottomSectionList) {
if (position != mySection.getPosition()) mySection.unSelect();
}
if (!deviceSupportMultiPane()) {
setDrawerTouchable(false);
}
}

Fixed version (ground truth):
@Override public void onClick(MaterialSection section){
switch (section.getTarget()) {
case MaterialSection.TARGET_FRAGMENT:
    setFragment((Fragment)section.getTargetFragment(),section.getTitle(),(Fragment)currentSection.getTargetFragment());
  changeToolbarColor(section);
if (!isCurrentFragmentChild) {
  childFragmentStack.remove(childFragmentStack.size() - 1);
  childTitleStack.remove(childTitleStack.size() - 1);
}
 else for (int i=childFragmentStack.size() - 1; i >= 0; i--) {
  childFragmentStack.remove(i);
  childTitleStack.remove(i);
}
childFragmentStack.add((Fragment)section.getTargetFragment());
childTitleStack.add(section.getTitle());
isCurrentFragmentChild=false;
pulsante.setDrawerIndicatorEnabled(true);
break;
case MaterialSection.TARGET_ACTIVITY:
this.startActivity(section.getTargetIntent());
if (!deviceSupportMultiPane()) layout.closeDrawer(drawer);
break;
case MaterialSection.TARGET_LISTENER:
if (!deviceSupportMultiPane()) layout.closeDrawer(drawer);
default :
break;
}
if (section.getTarget() != MaterialSection.TARGET_ACTIVITY) {
currentSection=section;
int position=section.getPosition();
for (MaterialSection mySection : sectionList) {
if (position != mySection.getPosition()) mySection.unSelect();
}
for (MaterialSection mySection : bottomSectionList) {
if (position != mySection.getPosition()) mySection.unSelect();
}
if (!deviceSupportMultiPane()) {
setDrawerTouchable(false);
}
}
}
Program: 92743
Project: 92743
Buggy source:
public MaterialAccount(Resources resources,String title,String subTitle,Bitmap photo,Bitmap background){
  this.title=title;
  this.subTitle=subTitle;
  this.resources=resources;
  if (photo != null)   resizePhotoBitmap.execute(photo);
  if (background != null)   resizeBackgroundBitmap.execute(background);
}

Fixed version (ground truth):
public MaterialAccount(Resources resources,String title,String subTitle,Bitmap photo,Bitmap background){
  this.title=title;
  this.subTitle=subTitle;
  this.resources=resources;
  if (photo != null)   new ResizePhotoBitmap().execute(photo);
  if (background != null)   new ResizeBackgroundBitmap().execute(background);
}
Program: 92744
Project: 92744
Buggy source:
public void setBackground(int background){
  resizeBackgroundResource.execute(background);
}

Fixed version (ground truth):
public void setBackground(int background){
  new ResizeBackgroundResource().execute(background);
}
Program: 92745
Project: 92745
Buggy source:
public void setPhoto(Bitmap photo){
  resizePhotoBitmap.execute(photo);
}

Fixed version (ground truth):
public void setPhoto(Bitmap photo){
  new ResizePhotoBitmap().execute(photo);
}
Program: 92746
Project: 92746
Buggy source:
/** 
 * Reload Application data from Account Information
 */
public void notifyAccountDataChanged(){
switch (accountManager.size()) {
case 3:
    this.setThirdAccountPhoto(findAccountNumber(MaterialAccount.THIRD_ACCOUNT).getCircularPhoto());
case 2:
  this.setSecondAccountPhoto(findAccountNumber(MaterialAccount.SECOND_ACCOUNT).getCircularPhoto());
case 1:
this.setFirstAccountPhoto(currentAccount.getCircularPhoto());
this.setDrawerHeaderImage(currentAccount.getBackground());
this.setUsername(currentAccount.getTitle());
this.setUserEmail(currentAccount.getSubTitle());
default :
}
}

Fixed version (ground truth):
/** 
 * Reload Application data from Account Information
 */
public void notifyAccountDataChanged(){
switch (accountManager.size()) {
default :
case 3:
    this.setThirdAccountPhoto(findAccountNumber(MaterialAccount.THIRD_ACCOUNT).getCircularPhoto());
case 2:
  this.setSecondAccountPhoto(findAccountNumber(MaterialAccount.SECOND_ACCOUNT).getCircularPhoto());
case 1:
this.setFirstAccountPhoto(currentAccount.getCircularPhoto());
this.setDrawerHeaderImage(currentAccount.getBackground());
this.setUsername(currentAccount.getTitle());
this.setUserEmail(currentAccount.getSubTitle());
case 0:
}
}
Program: 92748
Project: 92748
Buggy source:
@Override public void onClick(MaterialSection section){
  currentSection=section;
  if (section.getTarget() == MaterialSection.TARGET_FRAGMENT) {
    setFragment((Fragment)section.getTargetFragment(),section.getTitle());
    if (section.hasSectionColor()) {
      if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT)       this.statusBar.setImageDrawable(new ColorDrawable(darkenColor(section.getSectionColor())));
 else       this.statusBar.setImageDrawable(new ColorDrawable(section.getSectionColor()));
      this.getToolbar().setBackgroundColor(section.getSectionColor());
    }
 else {
      if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT)       this.statusBar.setImageDrawable(new ColorDrawable(darkenColor(primaryColor)));
 else       this.statusBar.setImageDrawable(new ColorDrawable(primaryColor));
      this.getToolbar().setBackgroundColor(primaryColor);
    }
  }
 else {
    this.startActivity(section.getTargetIntent());
  }
  int position=section.getPosition();
  for (  MaterialSection mySection : sectionList) {
    if (position != mySection.getPosition())     mySection.unSelect();
  }
  for (  MaterialSection mySection : bottomSectionList) {
    if (position != mySection.getPosition())     mySection.unSelect();
  }
}

Fixed version (ground truth):
@Override public void onClick(MaterialSection section){
  if (section.getTarget() == MaterialSection.TARGET_FRAGMENT) {
    setFragment((Fragment)section.getTargetFragment(),section.getTitle(),(Fragment)currentSection.getTargetFragment());
    if (section.hasSectionColor()) {
      if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT)       this.statusBar.setImageDrawable(new ColorDrawable(darkenColor(section.getSectionColor())));
 else       this.statusBar.setImageDrawable(new ColorDrawable(section.getSectionColor()));
      this.getToolbar().setBackgroundColor(section.getSectionColor());
    }
 else {
      if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT)       this.statusBar.setImageDrawable(new ColorDrawable(darkenColor(primaryColor)));
 else       this.statusBar.setImageDrawable(new ColorDrawable(primaryColor));
      this.getToolbar().setBackgroundColor(primaryColor);
    }
  }
 else {
    this.startActivity(section.getTargetIntent());
  }
  int position=section.getPosition();
  for (  MaterialSection mySection : sectionList) {
    if (position != mySection.getPosition())     mySection.unSelect();
  }
  for (  MaterialSection mySection : bottomSectionList) {
    if (position != mySection.getPosition())     mySection.unSelect();
  }
  currentSection=section;
}
Program: 92750
Project: 92750
Buggy source:
private void setFragment(Fragment fragment,String title){
  if (fragment instanceof android.app.Fragment)   getFragmentManager().beginTransaction().replace(R.id.frame_container,(android.app.Fragment)fragment).commit();
 else   if (fragment instanceof android.support.v4.app.Fragment)   getSupportFragmentManager().beginTransaction().replace(R.id.frame_container,(android.support.v4.app.Fragment)fragment).commit();
 else   throw new RuntimeException("String_Node_Str");
  setTitle(title);
  layout.closeDrawer(drawer);
}

Fixed version (ground truth):
private void setFragment(Fragment fragment,String title,Fragment oldFragment){
  if (fragment instanceof android.app.Fragment) {
    FragmentTransaction ft=getFragmentManager().beginTransaction();
    if (oldFragment != null)     ft.remove((android.app.Fragment)oldFragment);
    ft.replace(R.id.frame_container,(android.app.Fragment)fragment).commit();
  }
 else   if (fragment instanceof android.support.v4.app.Fragment) {
    android.support.v4.app.FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
    if (oldFragment != null)     ft.remove((android.support.v4.app.Fragment)oldFragment);
    ft.replace(R.id.frame_container,(android.support.v4.app.Fragment)fragment).commit();
  }
 else   throw new RuntimeException("String_Node_Str");
  setTitle(title);
  layout.closeDrawer(drawer);
}
Program: 92751
Project: 92751
Buggy source:
@Override public void callActivityOnCreate(Activity activity,Bundle icicle){
  lookupActivityInPlugin(activity);
  if (currentPlugin != null) {
    Context baseContext=activity.getBaseContext();
    PluginContext pluginContext=new PluginContext(baseContext,currentPlugin);
    try {
      try {
        Reflect.on(activity).set("String_Node_Str",pluginContext.getResources());
      }
 catch (      Throwable ignored) {
      }
      Field field=ContextWrapper.class.getDeclaredField("String_Node_Str");
      field.setAccessible(true);
      field.set(activity,pluginContext);
      Reflect.on(activity).set("String_Node_Str",currentPlugin.getApplication());
    }
 catch (    Throwable e) {
      e.printStackTrace();
    }
    try {
      Field themeRes=ContextThemeWrapper.class.getDeclaredField("String_Node_Str");
      themeRes.setAccessible(true);
      ActivityInfo activityInfo=currentPlugin.queryActivityInfoByName(activity.getClass().getName());
      if (activityInfo != null) {
        themeRes.set(activity,activityInfo.theme);
      }
    }
 catch (    Throwable ignored) {
    }
  }
  super.callActivityOnCreate(activity,icicle);
}

Fixed version (ground truth):
@Override public void callActivityOnCreate(Activity activity,Bundle icicle){
  lookupActivityInPlugin(activity);
  if (currentPlugin != null) {
    Context baseContext=activity.getBaseContext();
    PluginContext pluginContext=new PluginContext(baseContext,currentPlugin);
    try {
      try {
        Reflect.on(activity).set("String_Node_Str",pluginContext.getResources());
      }
 catch (      Throwable ignored) {
      }
      Field field=ContextWrapper.class.getDeclaredField("String_Node_Str");
      field.setAccessible(true);
      field.set(activity,pluginContext);
      Reflect.on(activity).set("String_Node_Str",currentPlugin.getApplication());
    }
 catch (    Throwable e) {
      e.printStackTrace();
    }
    ActivityInfo activityInfo=currentPlugin.queryActivityInfoByName(activity.getClass().getName());
    if (activityInfo != null) {
      activity.setTheme(activityInfo.theme);
    }
  }
  super.callActivityOnCreate(activity,icicle);
}
Program: 92752
Project: 92752
Buggy source:
/** 
 * 构造插件的Application
 * @param pluginClassLoader 类加载器
 * @param appClassName      类名
 * @return 插件App
 */
private Application makeApplication(PluginClassLoader pluginClassLoader,String appClassName){
  if (appClassName != null) {
    try {
      return (Application)pluginClassLoader.loadClass(appClassName).newInstance();
    }
 catch (    Throwable ignored) {
    }
  }
  return new Application();
}

Fixed version (ground truth):
/** 
 * 构造插件的Application
 * @param plugInfo 插件信息
 * @param appInfo 插件ApplicationInfo
 * @return 插件App
 */
private Application makeApplication(PlugInfo plugInfo,ApplicationInfo appInfo){
  String appClassName=appInfo.className;
  if (appClassName == null) {
    appClassName=Application.class.getName();
  }
  try {
    return (Application)plugInfo.getClassLoader().loadClass(appClassName).newInstance();
  }
 catch (  Throwable e) {
    throw new RuntimeException("String_Node_Str" + plugInfo.getPackageName() + "String_Node_Str"+ e.getMessage());
  }
}
Program: 92753
Project: 92753
Buggy source:
private PlugInfo buildPlugInfo(File pluginApk,String pluginId,String targetFileName) throws Exception {
  PlugInfo info=new PlugInfo();
  info.setId(pluginId == null ? pluginApk.getName() : pluginId);
  File privateFile=new File(dexInternalStoragePath,targetFileName == null ? pluginApk.getName() : targetFileName);
  info.setFilePath(privateFile.getAbsolutePath());
  if (!pluginApk.getAbsolutePath().equals(privateFile.getAbsolutePath())) {
    copyApkToPrivatePath(pluginApk,privateFile);
  }
  String dexPath=privateFile.getAbsolutePath();
  PluginManifestUtil.setManifestInfo(context,dexPath,info);
  try {
    AssetManager am=AssetManager.class.newInstance();
    am.getClass().getMethod("String_Node_Str",String.class).invoke(am,dexPath);
    info.setAssetManager(am);
    Resources hotRes=context.getResources();
    Resources res=new Resources(am,hotRes.getDisplayMetrics(),hotRes.getConfiguration());
    info.setResources(res);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  PluginClassLoader pluginClassLoader=new PluginClassLoader(info,dexPath,dexOutputPath,getPluginLibPath(info).getAbsolutePath(),pluginParentClassLoader);
  info.setClassLoader(pluginClassLoader);
  ApplicationInfo appInfo=info.getPackageInfo().applicationInfo;
  String appClassName=null;
  if (appInfo != null) {
    appClassName=appInfo.name;
  }
  Application app=makeApplication(pluginClassLoader,appClassName);
  attachBaseContext(info,app);
  info.setApplication(app);
  Trace.store("String_Node_Str" + info);
  return info;
}

Fixed version (ground truth):
private PlugInfo buildPlugInfo(File pluginApk,String pluginId,String targetFileName) throws Exception {
  PlugInfo info=new PlugInfo();
  info.setId(pluginId == null ? pluginApk.getName() : pluginId);
  File privateFile=new File(dexInternalStoragePath,targetFileName == null ? pluginApk.getName() : targetFileName);
  info.setFilePath(privateFile.getAbsolutePath());
  if (!pluginApk.getAbsolutePath().equals(privateFile.getAbsolutePath())) {
    copyApkToPrivatePath(pluginApk,privateFile);
  }
  String dexPath=privateFile.getAbsolutePath();
  PluginManifestUtil.setManifestInfo(context,dexPath,info);
  try {
    AssetManager am=AssetManager.class.newInstance();
    am.getClass().getMethod("String_Node_Str",String.class).invoke(am,dexPath);
    info.setAssetManager(am);
    Resources hotRes=context.getResources();
    Resources res=new Resources(am,hotRes.getDisplayMetrics(),hotRes.getConfiguration());
    info.setResources(res);
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str" + info.getPackageName() + "String_Node_Str"+ e.getMessage());
  }
  PluginClassLoader pluginClassLoader=new PluginClassLoader(info,dexPath,dexOutputPath,getPluginLibPath(info).getAbsolutePath(),pluginParentClassLoader);
  info.setClassLoader(pluginClassLoader);
  ApplicationInfo appInfo=info.getPackageInfo().applicationInfo;
  Application app=makeApplication(info,appInfo);
  attachBaseContext(info,app);
  info.setApplication(app);
  Trace.store("String_Node_Str" + info);
  return info;
}