nus-yam/ex-repair huggingface dataset:
Program: 31896
Project: 31896
Buggy source:
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  isBusy=true;
  this.canvasHeight=h;
  this.canvasWidth=w;
  if (oldh == 0 && h > 0 && readyCallback != null) {
    readyCallback.ready();
  }
  isBusy=false;
}

Fixed version (ground truth):
@Override protected void onSizeChanged(int w,int h,int oldw,int oldh){
  isBusy=true;
  this.canvasHeight=h;
  this.canvasWidth=w;
  Log.i(AnalyzeActivity.TAG,"String_Node_Str" + oldw + "String_Node_Str"+ oldh+ "String_Node_Str"+ w+ "String_Node_Str"+ h);
  if (oldh == 0 && h > 0 && readyCallback != null) {
    readyCallback.ready();
  }
  isBusy=false;
}
Program: 31897
Project: 31897
Buggy source:
private void drawGridLines(Canvas c,int nx,int ny){
  updateGridLabels(getMin(),getMax(),nx,GridScaleType.FREQ);
  for (int i=0; i < gridPoints2[0].length; i++) {
    float xPos=canvasViewX4axis((float)gridPoints2[0][i]);
    c.drawLine(xPos,0,xPos,canvasHeight,gridPaint);
  }
  for (int i=0; i < gridPoints2[1].length; i++) {
    float xPos=canvasViewX4axis((float)gridPoints2[1][i]);
    c.drawLine(xPos,0,xPos,0.03f * canvasHeight,gridPaint);
  }
  updateGridLabels(axisBounds.bottom,axisBounds.top,ny,GridScaleType.DB);
  for (int i=0; i < gridPoints2dB[0].length; i++) {
    float yPos=canvasViewY4axis((float)gridPoints2dB[0][i]);
    c.drawLine(0,yPos,canvasWidth,yPos,gridPaint);
  }
  for (int i=0; i < gridPoints2dB[1].length; i++) {
    float yPos=canvasViewY4axis((float)gridPoints2dB[1][i]);
    c.drawLine(0,yPos,0.02f * canvasWidth,yPos,gridPaint);
  }
}

Fixed version (ground truth):
private void drawGridLines(Canvas c,float nx,float ny){
  updateGridLabels(getMin(),getMax(),nx,GridScaleType.FREQ);
  for (int i=0; i < gridPoints2[0].length; i++) {
    float xPos=canvasViewX4axis((float)gridPoints2[0][i]);
    c.drawLine(xPos,0,xPos,canvasHeight,gridPaint);
  }
  for (int i=0; i < gridPoints2[1].length; i++) {
    float xPos=canvasViewX4axis((float)gridPoints2[1][i]);
    c.drawLine(xPos,0,xPos,0.03f * canvasHeight,gridPaint);
  }
  updateGridLabels(axisBounds.bottom,axisBounds.top,ny,GridScaleType.DB);
  for (int i=0; i < gridPoints2dB[0].length; i++) {
    float yPos=canvasViewY4axis((float)gridPoints2dB[0][i]);
    c.drawLine(0,yPos,canvasWidth,yPos,gridPaint);
  }
  for (int i=0; i < gridPoints2dB[1].length; i++) {
    float yPos=canvasViewY4axis((float)gridPoints2dB[1][i]);
    c.drawLine(0,yPos,0.02f * canvasWidth,yPos,gridPaint);
  }
}
Program: 31898
Project: 31898
Buggy source:
public void freq2Cent(StringBuilder a,double f,String sFill){
  a.setLength(0);
  if (f <= 0) {
    return;
  }
  double p=69 + 12 * Math.log(f / 440.0) / Math.log(2);
  int pi=(int)Math.round(p);
  final String[] L={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  a.append(L[pi % 12]);
  a.append(pi / 12 - 1);
  if (p - pi > 0) {
    a.append('+');
  }
  a.append(Math.round(100 * (p - pi)));
  while (a.length() < 6 && !sFill.isEmpty()) {
    a.append(sFill);
  }
}

Fixed version (ground truth):
public void freq2Cent(StringBuilder a,double f,String sFill){
  a.setLength(0);
  if (f <= 0 || Double.isNaN(f) || Double.isInfinite(f)) {
    return;
  }
  double p=69 + 12 * Math.log(f / 440.0) / Math.log(2);
  int pi=(int)Math.round(p);
  final String[] L={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  a.append(L[pi % 12]);
  a.append(pi / 12 - 1);
  if (p - pi > 0) {
    a.append('+');
  }
  a.append(Math.round(100 * (p - pi)));
  while (a.length() < 6 && !sFill.isEmpty()) {
    a.append(sFill);
  }
}
Program: 31899
Project: 31899
Buggy source:
private void drawGridLabels(Canvas c){
  float xPos, yPos;
  yPos=15;
  for (int i=0; i < gridPoints2Str.length; i++) {
    xPos=canvasViewX4axis((float)gridPoints2[0][i]);
    if (xPos > canvasWidth - 60)     continue;
    c.drawText(gridPoints2Str[i].toString(),xPos,yPos,labelPaint);
    c.drawLine(0,0,canvasWidth,0,labelPaint);
  }
  c.drawText("String_Node_Str",canvasWidth - 20,yPos,labelPaint);
  xPos=4;
  for (int i=0; i < gridPoints2StrDB.length; i++) {
    yPos=canvasViewY4axis((float)gridPoints2dB[0][i]);
    if (yPos > canvasHeight - 19)     continue;
    c.drawText(gridPoints2StrDB[i].toString(),xPos,yPos,labelPaint);
    c.drawLine(0,0,0,canvasHeight,labelPaint);
  }
  c.drawText("String_Node_Str",xPos,canvasHeight - 5,labelPaint);
}

Fixed version (ground truth):
private void drawGridLabels(Canvas c){
  float textHeigh=labelPaint.getFontMetrics(null);
  float widthHz=labelPaint.measureText("String_Node_Str");
  float xPos, yPos;
  yPos=textHeigh;
  for (int i=0; i < gridPoints2Str.length; i++) {
    xPos=canvasViewX4axis((float)gridPoints2[0][i]);
    if (xPos + labelPaint.measureText(gridPoints2Str[i].toString()) + 1.5f * widthHz > canvasWidth) {
      continue;
    }
    c.drawText(gridPoints2Str[i].toString(),xPos,yPos,labelPaint);
    c.drawLine(0,0,canvasWidth,0,labelPaint);
  }
  c.drawText("String_Node_Str",canvasWidth - 1.3f * widthHz,yPos,labelPaint);
  xPos=0.4f * widthHz;
  for (int i=0; i < gridPoints2StrDB.length; i++) {
    yPos=canvasViewY4axis((float)gridPoints2dB[0][i]);
    if (yPos + 1.3f * widthHz > canvasHeight)     continue;
    c.drawText(gridPoints2StrDB[i].toString(),xPos,yPos,labelPaint);
    c.drawLine(0,0,0,canvasHeight,labelPaint);
  }
  c.drawText("String_Node_Str",xPos,canvasHeight - 0.4f * widthHz,labelPaint);
}
Program: 31900
Project: 31900
Buggy source:
private void drawGridLines(Canvas c,float nx,float ny){
  updateGridLabels(getMinX(),getMaxX(),nx,GridScaleType.FREQ);
  for (int i=0; i < gridPoints2[0].length; i++) {
    float xPos=canvasViewX4axis((float)gridPoints2[0][i]);
    c.drawLine(xPos,0,xPos,canvasHeight,gridPaint);
  }
  for (int i=0; i < gridPoints2[1].length; i++) {
    float xPos=canvasViewX4axis((float)gridPoints2[1][i]);
    c.drawLine(xPos,0,xPos,0.03f * canvasHeight,gridPaint);
  }
  updateGridLabels(getMinY(),getMaxY(),ny,GridScaleType.DB);
  for (int i=0; i < gridPoints2dB[0].length; i++) {
    float yPos=canvasViewY4axis((float)gridPoints2dB[0][i]);
    c.drawLine(0,yPos,canvasWidth,yPos,gridPaint);
  }
  for (int i=0; i < gridPoints2dB[1].length; i++) {
    float yPos=canvasViewY4axis((float)gridPoints2dB[1][i]);
    c.drawLine(0,yPos,0.02f * canvasWidth,yPos,gridPaint);
  }
}

Fixed version (ground truth):
private void drawGridLines(Canvas c,float nx,float ny){
  updateGridLabels(getMinX(),getMaxX(),nx,GridScaleType.FREQ);
  for (int i=0; i < gridPoints2[0].length; i++) {
    float xPos=canvasViewX4axis((float)gridPoints2[0][i]);
    c.drawLine(xPos,0,xPos,canvasHeight,gridPaint);
  }
  for (int i=0; i < gridPoints2[1].length; i++) {
    float xPos=canvasViewX4axis((float)gridPoints2[1][i]);
    c.drawLine(xPos,0,xPos,0.02f * canvasHeight,gridPaint);
  }
  updateGridLabels(getMinY(),getMaxY(),ny,GridScaleType.DB);
  for (int i=0; i < gridPoints2dB[0].length; i++) {
    float yPos=canvasViewY4axis((float)gridPoints2dB[0][i]);
    c.drawLine(0,yPos,canvasWidth,yPos,gridPaint);
  }
  for (int i=0; i < gridPoints2dB[1].length; i++) {
    float yPos=canvasViewY4axis((float)gridPoints2dB[1][i]);
    c.drawLine(0,yPos,0.02f * canvasWidth,yPos,gridPaint);
  }
}
Program: 31901
Project: 31901
Buggy source:
private void updateViews(){
  mImageLoader=ImageTools.getImageLoader(mContext);
  mAdapter=new GalleryAdapter(mContext,mImageLoader,mParams,mAdapterEventListener);
  PauseOnScrollListener listener=new PauseOnScrollListener(mImageLoader,true,true);
  mGridGallery.setOnScrollListener(listener);
  mGridGallery.setOnItemClickListener(mItemClickListener);
  mGridGallery.setNumColumns(mParams.getNumClumns());
  mGridGallery.setSrollable(mParams.isGridViewScrollEnable());
  if (mParams.getShownStyle() != ShownStyle.Pick_Multiple) {
    mGridGallery.setFastScrollEnabled(true);
    mTitleBar.setVisibility(View.GONE);
  }
 else {
    mTitleBar.setVisibility(View.VISIBLE);
    if (null != mParams.getTitleSt()) {
      TextView title=(TextView)(mTitleBar.findViewById(R.id.picker_title));
      title.setText(mParams.getTitleSt());
    }
    if (-1 != mParams.getBarBgColorOpacity()) {
      mTitleBar.setBackgroundColor(mParams.getBarBgColorOpacity());
    }
 else {
      mTitleBar.setBackgroundResource(R.color.bg_bar_opacity);
    }
    if (null != mParams.getBtnBackDrawable()) {
      mBtnBack.setBackgroundDrawable(mParams.getBtnBackDrawable());
    }
 else {
      mBtnBack.setBackgroundResource(R.drawable.icon_back);
    }
    if (null != mParams.getBtnDoneBgDrawable()) {
      mBtnDone.setBackgroundDrawable(mParams.getBtnDoneBgDrawable());
    }
 else {
      mBtnDone.setBackgroundResource(R.color.clarity);
    }
    updateDoneString();
  }
  mGridGallery.setAdapter(mAdapter);
}

Fixed version (ground truth):
private void updateViews(){
  mImageLoader=ImageTools.getImageLoader(mContext);
  mAdapter=new GalleryAdapter(mContext,mImageLoader,mParams,mAdapterEventListener);
  PauseOnScrollListener listener=new PauseOnScrollListener(mImageLoader,true,true);
  mGridGallery.setOnScrollListener(listener);
  mGridGallery.setOnItemClickListener(mItemClickListener);
  mGridGallery.setNumColumns(mParams.getNumClumns());
  mGridGallery.setSrollable(mParams.isGridViewScrollEnable());
switch (mParams.getShownStyle()) {
case Pick_Single:
    mBtnDone.setVisibility(View.GONE);
  mGridGallery.setFastScrollEnabled(true);
case Pick_Multiple:
mTitleBar.setVisibility(View.VISIBLE);
if (null != mParams.getTitleSt()) {
TextView title=(TextView)(mTitleBar.findViewById(R.id.picker_title));
title.setText(mParams.getTitleSt());
}
if (-1 != mParams.getBarBgColorOpacity()) {
mTitleBar.setBackgroundColor(mParams.getBarBgColorOpacity());
}
 else {
mTitleBar.setBackgroundResource(R.color.bg_bar_opacity);
}
if (null != mParams.getBtnBackDrawable()) {
mBtnBack.setBackgroundDrawable(mParams.getBtnBackDrawable());
}
 else {
mBtnBack.setBackgroundResource(R.drawable.icon_back);
}
if (null != mParams.getBtnDoneBgDrawable()) {
mBtnDone.setBackgroundDrawable(mParams.getBtnDoneBgDrawable());
}
 else {
mBtnDone.setBackgroundResource(R.color.clarity);
}
updateDoneString();
break;
default :
mGridGallery.setFastScrollEnabled(true);
mTitleBar.setVisibility(View.GONE);
break;
}
mGridGallery.setAdapter(mAdapter);
}
Program: 31902
Project: 31902
Buggy source:
@Override public void onDone(int currentPosition){
  if (mParams.getShownStyle() == ShownStyle.Pick_Multiple) {
    ArrayList<ItemModel> selected=mAdapter.getSelected();
    String[] paths=new String[selected.size()];
    for (int i=0; i < paths.length; i++) {
      paths[i]=selected.get(i).mPath;
    }
    mListener.onDone(paths);
  }
 else {
    String[] paths=new String[1];
    paths[0]=mModelsList.get(currentPosition).mPath;
    mListener.onDone(paths);
  }
}

Fixed version (ground truth):
@Override public void onDone(int currentPosition){
  ArrayList<ItemModel> selected=mAdapter.getSelected();
  String[] paths=new String[selected.size()];
  for (int i=0; i < paths.length; i++) {
    paths[i]=selected.get(i).mPath;
  }
  mListener.onDone(paths);
}
Program: 31903
Project: 31903
Buggy source:
private boolean checkImageStatus(){
  boolean result=false;
switch (mModelsList.size()) {
case 1:
    if (ShownStyle.ViewOnly == mParams.getShownStyle()) {
      result=true;
      mImgNoMedia.setVisibility(View.VISIBLE);
      mImageLoader.displayImage(mModelsList.get(0).mPath,mImgNoMedia,new SimpleImageLoadingListener(){
        @Override public void onLoadingStarted(        String imageUri,        View view){
          if (null != mParams.getLoadingImageDrawable()) {
            mImgNoMedia.setImageDrawable(mParams.getLoadingImageDrawable());
          }
 else {
            mImgNoMedia.setImageResource(R.drawable.no_media);
          }
          super.onLoadingStarted(imageUri,view);
        }
      }
);
      mImgNoMedia.setClickable(true);
      mImgNoMedia.setOnClickListener(mOnSingleImageClickListener);
    }
  break;
case 0:
result=true;
mImgNoMedia.setVisibility(View.VISIBLE);
mImgNoMedia.setImageResource(R.drawable.no_media);
mImgNoMedia.setClickable(false);
break;
default :
break;
}
if (!result) {
mImgNoMedia.setVisibility(View.GONE);
}
return result;
}

Fixed version (ground truth):
private boolean checkImageStatus(){
  boolean result=false;
switch (mModelsList.size()) {
case 1:
    if (ShownStyle.ViewOnly == mParams.getShownStyle()) {
      result=true;
      mImgNoMedia.setVisibility(View.VISIBLE);
      mImageLoader.displayImage(mModelsList.get(0).mPath,mImgNoMedia,new SimpleImageLoadingListener(){
        @Override public void onLoadingStarted(        String imageUri,        View view){
          if (null != mParams.getLoadingImageDrawable()) {
            mImgNoMedia.setImageDrawable(mParams.getLoadingImageDrawable());
          }
 else {
            mImgNoMedia.setImageResource(R.drawable.no_media);
          }
          super.onLoadingStarted(imageUri,view);
        }
      }
);
      mImgNoMedia.setClickable(true);
      mImgNoMedia.setOnClickListener(mOnSingleImageClickListener);
    }
  break;
case 0:
if (ShownStyle.ViewAndDelete != mParams.getShownStyle()) {
  result=true;
  mImgNoMedia.setVisibility(View.VISIBLE);
  mImgNoMedia.setImageResource(R.drawable.no_media);
  mImgNoMedia.setClickable(false);
}
break;
default :
break;
}
if (!result) {
mImgNoMedia.setVisibility(View.GONE);
}
return result;
}
Program: 31904
Project: 31904
Buggy source:
private void initDeltableParams(ViewParams params){
  ArrayList<TransitionEffect> transitionEffects=new ArrayList<ViewParams.TransitionEffect>();
  transitionEffects.add(ViewParams.TransitionEffect.CubeOut);
  transitionEffects.add(ViewParams.TransitionEffect.FlipHorizontal);
  transitionEffects.add(ViewParams.TransitionEffect.FlipVertical);
  params.setTransitionEffects(transitionEffects);
  params.setShownStyle(ShownStyle.ViewAndDelete);
  params.setNumClumns(4);
  params.setLoadingImageDrawable(getResources().getDrawable(R.drawable.image_view_loading_default));
  params.setBtnBackDrawable(getResources().getDrawable(R.drawable.icon_1_back));
  params.setDeleteItemDrawable(getResources().getDrawable(R.drawable.icon_1_delete));
  params.setBarBgColorOpacity(getResources().getColor(R.color.bg_1_bar_opacity));
  params.setBarBgColorClarity(getResources().getColor(R.color.bg_1_bar_clarity));
}

Fixed version (ground truth):
private void initDeltableParams(ViewParams params){
  ArrayList<TransitionEffect> transitionEffects=new ArrayList<ViewParams.TransitionEffect>();
  transitionEffects.add(ViewParams.TransitionEffect.CubeOut);
  transitionEffects.add(ViewParams.TransitionEffect.FlipHorizontal);
  transitionEffects.add(ViewParams.TransitionEffect.FlipVertical);
  params.setTransitionEffects(transitionEffects);
  params.setShownStyle(ShownStyle.ViewAndDelete);
  params.setGridViewScrollEnable(false);
  params.setNumClumns(4);
  params.setLoadingImageDrawable(getResources().getDrawable(R.drawable.image_view_loading_default));
  params.setBtnBackDrawable(getResources().getDrawable(R.drawable.icon_1_back));
  params.setDeleteItemDrawable(getResources().getDrawable(R.drawable.icon_1_delete));
  params.setBarBgColorOpacity(getResources().getColor(R.color.bg_1_bar_opacity));
  params.setBarBgColorClarity(getResources().getColor(R.color.bg_1_bar_clarity));
}
Program: 31905
Project: 31905
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  int expandSpec=MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,MeasureSpec.AT_MOST);
  super.onMeasure(widthMeasureSpec,expandSpec);
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  if (isScrollable) {
    super.onMeasure(widthMeasureSpec,heightMeasureSpec);
  }
 else {
    int expandSpec=MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,MeasureSpec.AT_MOST);
    super.onMeasure(widthMeasureSpec,expandSpec);
  }
}
Program: 31906
Project: 31906
Buggy source:
private void init(){
  mGridGallery=(GridView)mImagePicker.findViewById(R.id.gridGallery);
  mImgNoMedia=(ImageView)mImagePicker.findViewById(R.id.imgNoMedia);
  mBtnDone=(Button)mTitleBar.findViewById(R.id.picker_done);
  mBtnDone.setOnClickListener(mDoneClickListener);
  mBtnBack=(Button)mTitleBar.findViewById(R.id.picker_back);
  mBtnBack.setOnClickListener(mBackClickListener);
}

Fixed version (ground truth):
private void init(){
  mGridGallery=(CustGridView)mImagePicker.findViewById(R.id.gridGallery);
  mImgNoMedia=(ImageView)mImagePicker.findViewById(R.id.imgNoMedia);
  mBtnDone=(Button)mTitleBar.findViewById(R.id.picker_done);
  mBtnDone.setOnClickListener(mDoneClickListener);
  mBtnBack=(Button)mTitleBar.findViewById(R.id.picker_back);
  mBtnBack.setOnClickListener(mBackClickListener);
}
Program: 31907
Project: 31907
Buggy source:
private void updateViews(){
  mImageLoader=ImageTools.getImageLoader(mContext);
  mAdapter=new GalleryAdapter(mContext,mImageLoader,mParams,mAdapterEventListener);
  PauseOnScrollListener listener=new PauseOnScrollListener(mImageLoader,true,true);
  mGridGallery.setOnScrollListener(listener);
  mGridGallery.setOnItemClickListener(mItemClickListener);
  mGridGallery.setNumColumns(mParams.getNumClumns());
  if (mParams.getShownStyle() != ShownStyle.Pick_Multiple) {
    mGridGallery.setFastScrollEnabled(true);
    mTitleBar.setVisibility(View.GONE);
  }
 else {
    mTitleBar.setVisibility(View.VISIBLE);
    if (null != mParams.getTitleSt()) {
      TextView title=(TextView)(mTitleBar.findViewById(R.id.picker_title));
      title.setText(mParams.getTitleSt());
    }
    if (-1 != mParams.getBarBgColorOpacity()) {
      mTitleBar.setBackgroundColor(mParams.getBarBgColorOpacity());
    }
 else {
      mTitleBar.setBackgroundResource(R.color.bg_bar_opacity);
    }
    if (null != mParams.getBtnBackDrawable()) {
      mBtnBack.setBackgroundDrawable(mParams.getBtnBackDrawable());
    }
 else {
      mBtnBack.setBackgroundResource(R.drawable.icon_back);
    }
    if (null != mParams.getBtnDoneBgDrawable()) {
      mBtnDone.setBackgroundDrawable(mParams.getBtnDoneBgDrawable());
    }
 else {
      mBtnDone.setBackgroundResource(R.color.clarity);
    }
    updateDoneString();
  }
  mGridGallery.setAdapter(mAdapter);
}

Fixed version (ground truth):
private void updateViews(){
  mImageLoader=ImageTools.getImageLoader(mContext);
  mAdapter=new GalleryAdapter(mContext,mImageLoader,mParams,mAdapterEventListener);
  PauseOnScrollListener listener=new PauseOnScrollListener(mImageLoader,true,true);
  mGridGallery.setOnScrollListener(listener);
  mGridGallery.setOnItemClickListener(mItemClickListener);
  mGridGallery.setNumColumns(mParams.getNumClumns());
  mGridGallery.setSrollable(mParams.isGridViewScrollEnable());
  if (mParams.getShownStyle() != ShownStyle.Pick_Multiple) {
    mGridGallery.setFastScrollEnabled(true);
    mTitleBar.setVisibility(View.GONE);
  }
 else {
    mTitleBar.setVisibility(View.VISIBLE);
    if (null != mParams.getTitleSt()) {
      TextView title=(TextView)(mTitleBar.findViewById(R.id.picker_title));
      title.setText(mParams.getTitleSt());
    }
    if (-1 != mParams.getBarBgColorOpacity()) {
      mTitleBar.setBackgroundColor(mParams.getBarBgColorOpacity());
    }
 else {
      mTitleBar.setBackgroundResource(R.color.bg_bar_opacity);
    }
    if (null != mParams.getBtnBackDrawable()) {
      mBtnBack.setBackgroundDrawable(mParams.getBtnBackDrawable());
    }
 else {
      mBtnBack.setBackgroundResource(R.drawable.icon_back);
    }
    if (null != mParams.getBtnDoneBgDrawable()) {
      mBtnDone.setBackgroundDrawable(mParams.getBtnDoneBgDrawable());
    }
 else {
      mBtnDone.setBackgroundResource(R.color.clarity);
    }
    updateDoneString();
  }
  mGridGallery.setAdapter(mAdapter);
}
Program: 31908
Project: 31908
Buggy source:
@Override public void onDismiss(){
  quitFullScreen();
  updateDoneNumbers();
switch (mParams.getShownStyle()) {
case Pick_Multiple:
    mAdapter.notifyDataSetChanged();
  break;
case ViewAndDelete:
if (mModelsList.size() != mAdapter.getCount()) {
  mAdapter.addAll(mModelsList);
}
break;
default :
break;
}
}

Fixed version (ground truth):
@Override public void onDismiss(){
  quitFullScreen();
  updateDoneString();
switch (mParams.getShownStyle()) {
case Pick_Multiple:
    mAdapter.notifyDataSetChanged();
  break;
case ViewAndDelete:
if (mModelsList.size() != mAdapter.getCount()) {
  mAdapter.addAll(mModelsList);
}
break;
default :
break;
}
}
Program: 31909
Project: 31909
Buggy source:
private void updateViews(){
  mImageLoader=ImageTools.getImageLoader(mContext);
  mAdapter=new GalleryAdapter(mContext,mImageLoader,mParams,mAdapterEventListener);
  PauseOnScrollListener listener=new PauseOnScrollListener(mImageLoader,true,true);
  mGridGallery.setOnScrollListener(listener);
  mGridGallery.setOnItemClickListener(mItemClickListener);
  mGridGallery.setNumColumns(mParams.getNumClumns());
  if (mParams.getShownStyle() != ShownStyle.Pick_Multiple) {
    mGridGallery.setFastScrollEnabled(true);
    mTitleBar.setVisibility(View.GONE);
  }
 else {
    mTitleBar.setVisibility(View.VISIBLE);
    if (null != mParams.getTitleSt()) {
      TextView title=(TextView)(mTitleBar.findViewById(R.id.picker_title));
      title.setText(mParams.getTitleSt());
    }
    if (-1 != mParams.getBarBgColorOpacity()) {
      mTitleBar.setBackgroundColor(mParams.getBarBgColorOpacity());
    }
 else {
      mTitleBar.setBackgroundResource(R.color.bg_bar_opacity);
    }
    if (null != mParams.getBtnBackDrawable()) {
      mBtnBack.setBackgroundDrawable(mParams.getBtnBackDrawable());
    }
 else {
      mBtnBack.setBackgroundResource(R.drawable.icon_back);
    }
    if (null != mParams.getBtnDoneBgDrawable()) {
      mBtnDone.setBackgroundDrawable(mParams.getBtnDoneBgDrawable());
    }
 else {
      mBtnDone.setBackgroundResource(R.color.clarity);
    }
    updateDoneNumbers();
  }
  mGridGallery.setAdapter(mAdapter);
}

Fixed version (ground truth):
private void updateViews(){
  mImageLoader=ImageTools.getImageLoader(mContext);
  mAdapter=new GalleryAdapter(mContext,mImageLoader,mParams,mAdapterEventListener);
  PauseOnScrollListener listener=new PauseOnScrollListener(mImageLoader,true,true);
  mGridGallery.setOnScrollListener(listener);
  mGridGallery.setOnItemClickListener(mItemClickListener);
  mGridGallery.setNumColumns(mParams.getNumClumns());
  if (mParams.getShownStyle() != ShownStyle.Pick_Multiple) {
    mGridGallery.setFastScrollEnabled(true);
    mTitleBar.setVisibility(View.GONE);
  }
 else {
    mTitleBar.setVisibility(View.VISIBLE);
    if (null != mParams.getTitleSt()) {
      TextView title=(TextView)(mTitleBar.findViewById(R.id.picker_title));
      title.setText(mParams.getTitleSt());
    }
    if (-1 != mParams.getBarBgColorOpacity()) {
      mTitleBar.setBackgroundColor(mParams.getBarBgColorOpacity());
    }
 else {
      mTitleBar.setBackgroundResource(R.color.bg_bar_opacity);
    }
    if (null != mParams.getBtnBackDrawable()) {
      mBtnBack.setBackgroundDrawable(mParams.getBtnBackDrawable());
    }
 else {
      mBtnBack.setBackgroundResource(R.drawable.icon_back);
    }
    if (null != mParams.getBtnDoneBgDrawable()) {
      mBtnDone.setBackgroundDrawable(mParams.getBtnDoneBgDrawable());
    }
 else {
      mBtnDone.setBackgroundResource(R.color.clarity);
    }
    updateDoneString();
  }
  mGridGallery.setAdapter(mAdapter);
}
Program: 31910
Project: 31910
Buggy source:
@Override public void onItemSelectedStatusChange(int position,boolean isSelected){
  updateDoneNumbers();
}

Fixed version (ground truth):
@Override public void onItemSelectedStatusChange(int position,boolean isSelected){
  updateDoneString();
}
Program: 31911
Project: 31911
Buggy source:
private void updateTitle(){
  mTitle.setText("String_Node_Str" + (mCurrentItem + 1) + "String_Node_Str"+ mModelsList.size());
  String doneSt=null;
  if (null != mParams.getDoneSt()) {
    doneSt=mParams.getDoneSt();
  }
 else {
    doneSt=mJazzy.getResources().getString(R.string.done);
  }
  mBtnDone.setText(doneSt + "String_Node_Str" + getSelectedSize()+ "String_Node_Str"+ mParams.getMaxPickSize()+ "String_Node_Str");
}

Fixed version (ground truth):
private void updateTitle(){
  mTitle.setText("String_Node_Str" + (mCurrentItem + 1) + "String_Node_Str"+ mModelsList.size());
  String doneSt=null;
  if (null != mParams.getDoneSt()) {
    doneSt=mParams.getDoneSt();
  }
 else {
    doneSt=mJazzy.getResources().getString(R.string.done);
  }
switch (mParams.getShownStyle()) {
case Pick_Multiple:
    mBtnDone.setText(doneSt + "String_Node_Str" + getSelectedSize()+ "String_Node_Str"+ mParams.getMaxPickSize()+ "String_Node_Str");
  break;
default :
mBtnDone.setText(doneSt);
break;
}
}
Program: 31912
Project: 31912
Buggy source:
@Override public void onDismiss(){
  quitFullScreen();
  updateDoneString();
switch (mParams.getShownStyle()) {
case Pick_Multiple:
    mAdapter.notifyDataSetChanged();
  break;
case ViewAndDelete:
if (mModelsList.size() != mAdapter.getCount()) {
  mAdapter.addAll(mModelsList);
  mListener.onImageDataChanged();
}
break;
default :
break;
}
}

Fixed version (ground truth):
@Override public void onDismiss(){
  quitFullScreen();
  updateDoneString();
switch (mParams.getShownStyle()) {
case Pick_Multiple:
    mAdapter.notifyDataSetChanged();
  break;
case ViewAndDelete:
removeDeletedItems();
if (mModelsList.size() != mAdapter.getCount()) {
mAdapter.addAll(mModelsList);
mListener.onImageDataChanged();
}
break;
default :
break;
}
}
Program: 31913
Project: 31913
Buggy source:
@Override public void onClick(View v){
  int position=mJazzy.getCurrentItem();
  if (mModelsList.size() == 1) {
    mModelsList.remove(position);
    mBtnBack.performClick();
  }
 else {
    mModelsList.remove(position);
    mJazzy.notifyChange();
    updateTitle();
  }
}

Fixed version (ground truth):
@Override public void onClick(View v){
  int position=mJazzy.getCurrentItem();
  mModelsList.get(position).isSeleted=true;
  if (mModelsList.size() == 1) {
    mModelsList.remove(position);
    mBtnBack.performClick();
  }
 else {
    mModelsList.remove(position);
    mJazzy.notifyChange();
    updateTitle();
  }
}
Program: 31914
Project: 31914
Buggy source:
public ViewPagerDialogFragment(ArrayList<ItemModel> modelsList,ViewParams params,int currentItem){
  mModelsList=modelsList;
  mCurrentItem=currentItem;
  mParams=params;
}

Fixed version (ground truth):
public ViewPagerDialogFragment(ArrayList<ItemModel> modelsList,ViewParams params,int currentItem){
  mModelsList.addAll(modelsList);
  mCurrentItem=currentItem;
  removeFunctionItems();
  mParams=params;
}
Program: 31916
Project: 31916
Buggy source:
@Override public void onItemClick(AdapterView<?> l,View v,int position,long id){
  if (mModelsList.get(position).isCameraPhoto) {
    Log.d(TAG,"String_Node_Str");
    return;
  }
  showPagerView(position);
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> l,View v,int position,long id){
  if (mModelsList.get(position).isCameraPhoto) {
    mListener.onTakeingPhoto();
    return;
  }
  showPagerView(position);
}
Program: 31918
Project: 31918
Buggy source:
private void initParams(ViewParams params){
  params.setMutiPick(false);
  params.setViewOnlyModel(true);
  params.setNumClumns(5);
}

Fixed version (ground truth):
private void initParams(ViewParams params){
  params.setMutiPick(false);
  params.setViewOnlyModel(true);
  params.setNumClumns(5);
  params.setLoadingImageDrawable(getResources().getDrawable(R.drawable.image_view_loading_default));
}
Program: 31919
Project: 31919
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.activity_main);
  ViewParams params=new ViewParams(true);
  initParams(params);
  mLayout=(LinearLayout)findViewById(R.id.shown_layout);
  mImagePicker=new GridViewPicker(mLayout,params,mViewPickerListener);
  mImagePicker.initialize(getSupportFragmentManager());
  init();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.activity_main);
  ViewParams params=new ViewParams(getResources().getDisplayMetrics());
  initParams(params);
  mLayout=(LinearLayout)findViewById(R.id.shown_layout);
  mImagePicker=new GridViewPicker(mLayout,params,mViewPickerListener);
  mImagePicker.initialize(getSupportFragmentManager());
  init();
}
Program: 31920
Project: 31920
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.gallery);
  ViewParams params=new ViewParams(true);
  initParams(params);
  mLayout=(LinearLayout)findViewById(R.id.picker_layout);
  mImagePicker=new GridViewPicker(mLayout,params,mViewPickerListener);
  mImagePicker.initialize(getSupportFragmentManager());
  ArrayList<ItemModel> modelList=new ArrayList<ItemModel>();
  ItemModel item=new ItemModel();
  item.isCameraPhoto=true;
  modelList.add(item);
  modelList.addAll(ImageTools.getGalleryPhotos(getContentResolver()));
  mImagePicker.setImagePath(modelList);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.gallery);
  ViewParams params=new ViewParams(getResources().getDisplayMetrics());
  initParams(params);
  mLayout=(LinearLayout)findViewById(R.id.picker_layout);
  mImagePicker=new GridViewPicker(mLayout,params,mViewPickerListener);
  mImagePicker.initialize(getSupportFragmentManager());
  ArrayList<ItemModel> modelList=new ArrayList<ItemModel>();
  ItemModel item=new ItemModel();
  item.isCameraPhoto=true;
  modelList.add(item);
  modelList.addAll(ImageTools.getGalleryPhotos(getContentResolver()));
  mImagePicker.setImagePath(modelList);
}
Program: 31921
Project: 31921
Buggy source:
public ViewParams(boolean isMutiPick){
  this.isMutiPick=isMutiPick;
}

Fixed version (ground truth):
public ViewParams(DisplayMetrics metrics){
  this.mMetics=metrics;
}
Program: 31923
Project: 31923
Buggy source:
private void initViews(){
  mJazzy.setImagePath(mModelsList);
  mJazzy.setCurrentItem(mCurrentItem);
  mJazzy.setPageMargin(0);
  mBtnBack=(Button)mPagerTitleBar.findViewById(R.id.picker_back);
  mPagerTitleBar.setBackgroundResource(R.color.bg_bottom_bar);
  mBtnDone=(Button)mPagerTitleBar.findViewById(R.id.picker_done);
  mCheckBox=(ImageView)mPagerBottomBar.findViewById(R.id.focus_checkbox);
  mJazzy.setOnPageChangeListener(mOnPageChangeListener);
  mBtnBack.setOnClickListener(mOnBackClickListener);
  mBtnDone.setOnClickListener(mOnDoneClickListener);
  mJazzy.setTransitionEffect(mParams.getTransitionEffect());
  mJazzy.setPhotoViewListener(mPhotoViewListener);
switch (mParams.getShownStyle()) {
case Pick_Multiple:
    mCheckBox.setSelected(mModelsList.get(mCurrentItem).isSeleted);
  mCheckBox.setOnClickListener(mOnCheckBoxClickedListener);
if (mParams.getCheckBoxDrawable() != null) {
  mCheckBox.setImageDrawable(mParams.getCheckBoxDrawable());
}
mPagerBottomBar.setVisibility(View.VISIBLE);
break;
case Pick_Single:
mPagerBottomBar.setVisibility(View.GONE);
break;
case ViewOnly:
mBtnDone.setVisibility(View.GONE);
mPagerBottomBar.setVisibility(View.GONE);
case ViewAndDelete:
mCheckBox.setImageResource(R.drawable.icon_delete);
mCheckBox.setOnClickListener(mOnDeleteClickedListener);
if (mParams.getDeleteItemDrawable() != null) {
mCheckBox.setImageDrawable(mParams.getDeleteItemDrawable());
}
mPagerBottomBar.setVisibility(View.VISIBLE);
break;
default :
break;
}
}

Fixed version (ground truth):
private void initViews(){
  mJazzy.setImagePath(mModelsList);
  mJazzy.setCurrentItem(mCurrentItem);
  mJazzy.setPageMargin(0);
  mBtnBack=(Button)mPagerTitleBar.findViewById(R.id.picker_back);
  mPagerTitleBar.setBackgroundResource(R.color.bg_bottom_bar);
  mBtnDone=(Button)mPagerTitleBar.findViewById(R.id.picker_done);
  mCheckBox=(ImageView)mPagerBottomBar.findViewById(R.id.focus_checkbox);
  mJazzy.setOnPageChangeListener(mOnPageChangeListener);
  mBtnBack.setOnClickListener(mOnBackClickListener);
  mBtnDone.setOnClickListener(mOnDoneClickListener);
  mJazzy.setTransitionEffect(mParams.getTransitionEffect());
  mJazzy.setPhotoViewListener(mPhotoViewListener);
switch (mParams.getShownStyle()) {
case Pick_Multiple:
    mCheckBox.setSelected(mModelsList.get(mCurrentItem).isSeleted);
  mCheckBox.setOnClickListener(mOnCheckBoxClickedListener);
if (mParams.getCheckBoxDrawable() != null) {
  mCheckBox.setImageDrawable(mParams.getCheckBoxDrawable());
}
mPagerBottomBar.setVisibility(View.VISIBLE);
break;
case Pick_Single:
mPagerBottomBar.setVisibility(View.GONE);
break;
case ViewOnly:
mBtnDone.setVisibility(View.GONE);
mPagerBottomBar.setVisibility(View.GONE);
break;
case ViewAndDelete:
mCheckBox.setImageResource(R.drawable.icon_delete);
mCheckBox.setOnClickListener(mOnDeleteClickedListener);
if (mParams.getDeleteItemDrawable() != null) {
mCheckBox.setImageDrawable(mParams.getDeleteItemDrawable());
}
mPagerBottomBar.setVisibility(View.VISIBLE);
break;
default :
break;
}
}
Program: 31924
Project: 31924
Buggy source:
private void fullScreen(){
  isFullScreen=!isFullScreen;
  mViewPagerEventListener.setFullScreen(isFullScreen);
  if (isFullScreen) {
    mPagerTitleBar.setVisibility(View.GONE);
    mPagerBottomBar.setVisibility(View.GONE);
  }
 else {
    mPagerTitleBar.setVisibility(View.VISIBLE);
    mPagerBottomBar.setVisibility(View.VISIBLE);
  }
}

Fixed version (ground truth):
private void fullScreen(){
  isFullScreen=!isFullScreen;
  mViewPagerEventListener.setFullScreen(isFullScreen);
  if (isFullScreen) {
    mPagerTitleBar.setVisibility(View.GONE);
    mPagerBottomBar.setVisibility(View.GONE);
  }
 else {
    mPagerTitleBar.setVisibility(View.VISIBLE);
switch (mParams.getShownStyle()) {
case Pick_Multiple:
      mPagerBottomBar.setVisibility(View.VISIBLE);
    break;
case Pick_Single:
  mPagerBottomBar.setVisibility(View.GONE);
break;
case ViewOnly:
mPagerBottomBar.setVisibility(View.GONE);
break;
case ViewAndDelete:
mPagerBottomBar.setVisibility(View.VISIBLE);
break;
default :
break;
}
}
}
Program: 31925
Project: 31925
Buggy source:
private void initParams(ViewParams params){
  ArrayList<TransitionEffect> transitionEffects=new ArrayList<ViewParams.TransitionEffect>();
  transitionEffects.add(ViewParams.TransitionEffect.CubeOut);
  transitionEffects.add(ViewParams.TransitionEffect.FlipHorizontal);
  transitionEffects.add(ViewParams.TransitionEffect.FlipVertical);
  params.setTransitionEffects(transitionEffects);
  params.setShownStyle(ShownStyle.ViewOnly);
  params.setNumClumns(5);
  params.setLoadingImageDrawable(getResources().getDrawable(R.drawable.image_view_loading_default));
}

Fixed version (ground truth):
private void initParams(ViewParams params){
  ArrayList<TransitionEffect> transitionEffects=new ArrayList<ViewParams.TransitionEffect>();
  transitionEffects.add(ViewParams.TransitionEffect.CubeOut);
  transitionEffects.add(ViewParams.TransitionEffect.FlipHorizontal);
  transitionEffects.add(ViewParams.TransitionEffect.FlipVertical);
  params.setTransitionEffects(transitionEffects);
  params.setShownStyle(ShownStyle.ViewAndDelete);
  params.setNumClumns(5);
  params.setLoadingImageDrawable(getResources().getDrawable(R.drawable.image_view_loading_default));
}
Program: 31927
Project: 31927
Buggy source:
private void init(){
  mGridGallery=(GridView)mImagePicker.findViewById(R.id.gridGallery);
  mImgNoMedia=(ImageView)mImagePicker.findViewById(R.id.imgNoMedia);
  mBtnDone=(Button)mTitleBar.findViewById(R.id.picker_done);
  mBtnDone.setOnClickListener(mDoneClickListener);
  mBtnBack=(Button)mTitleBar.findViewById(R.id.picker_back);
  mBtnBack.setOnClickListener(mBackClickListener);
}

Fixed version (ground truth):
private void init(){
  mGridGallery=(GridView)mImagePicker.findViewById(R.id.gridGallery);
  if (!mParams.isMutiPick()) {
    mGridGallery.setFastScrollEnabled(true);
  }
  mImgNoMedia=(ImageView)mImagePicker.findViewById(R.id.imgNoMedia);
  mBtnDone=(Button)mTitleBar.findViewById(R.id.picker_done);
  mBtnDone.setOnClickListener(mDoneClickListener);
  mBtnBack=(Button)mTitleBar.findViewById(R.id.picker_back);
  mBtnBack.setOnClickListener(mBackClickListener);
}
Program: 31928
Project: 31928
Buggy source:
private void checkImageStatus(){
  if (mAdapter.isEmpty()) {
    mImgNoMedia.setVisibility(View.VISIBLE);
  }
 else {
    mImgNoMedia.setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
private void checkImageStatus(){
  if (mModelsList.isEmpty()) {
    mImgNoMedia.setVisibility(View.VISIBLE);
  }
 else {
    mImgNoMedia.setVisibility(View.GONE);
  }
}
Program: 31929
Project: 31929
Buggy source:
public void setImagePath(final ArrayList<ItemModel> modelsList){
  mModelsList=modelsList;
  new Thread(){
    @Override public void run(){
      Looper.prepare();
      mHandler.post(new Runnable(){
        @Override public void run(){
          mAdapter.addAll(modelsList);
          checkImageStatus();
        }
      }
);
      Looper.loop();
    }
  }
.start();
}

Fixed version (ground truth):
public void setImagePath(final ArrayList<ItemModel> modelsList){
  mModelsList=modelsList;
  new Thread(){
    @Override public void run(){
      Looper.prepare();
      mHandler.post(new Runnable(){
        @Override public void run(){
          checkImageStatus();
          mAdapter.addAll(mModelsList);
        }
      }
);
      Looper.loop();
    }
  }
.start();
}
Program: 31930
Project: 31930
Buggy source:
@Override public void run(){
  mAdapter.addAll(modelsList);
  checkImageStatus();
}

Fixed version (ground truth):
@Override public void run(){
  checkImageStatus();
  mAdapter.addAll(mModelsList);
}
Program: 31931
Project: 31931
Buggy source:
private void initParams(ViewParams params){
  String action=getIntent().getAction();
  if (action == null) {
    finish();
  }
  if (action.equalsIgnoreCase(ViewPickerActivity.ACTION_MULTIPLE_PICK)) {
    params.setMutiPick(true);
  }
 else   if (action.equalsIgnoreCase(ViewPickerActivity.ACTION_PICK)) {
    params.setMutiPick(false);
  }
  params.setViewOnlyModel(false);
  params.setNumClumns(4);
  params.setCheckBoxDrawable(getResources().getDrawable(R.drawable.on_1_checkbox));
  params.setTakePhotoDrawable(getResources().getDrawable(R.drawable.icon_take_photo));
}

Fixed version (ground truth):
private void initParams(ViewParams params){
  String action=getIntent().getAction();
  if (action == null) {
    finish();
  }
  if (action.equalsIgnoreCase(ViewPickerActivity.ACTION_MULTIPLE_PICK)) {
    params.setMutiPick(true);
  }
 else   if (action.equalsIgnoreCase(ViewPickerActivity.ACTION_PICK)) {
    params.setMutiPick(false);
  }
  params.setViewOnlyModel(false);
  params.setCheckBoxDrawable(getResources().getDrawable(R.drawable.on_1_checkbox));
  params.setTakePhotoDrawable(getResources().getDrawable(R.drawable.icon_take_photo));
}
Program: 31932
Project: 31932
Buggy source:
/** 
 * Start the ringing sound.
 * @param resId    the ring sound id
 * @param filename the filename to save the ringtone
 */
public void startRinging(int resId,String filename){
  Log.d(LOG_TAG,"String_Node_Str");
  mIsRinging=true;
  if (null != mRingTone) {
    Log.d(LOG_TAG,"String_Node_Str");
    return;
  }
  stopSounds();
  mRingTone=getRingTone(mContext,resId,filename,RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE));
  if (null != mRingTone) {
    setSpeakerphoneOn(false,true);
    mRingTone.play();
  }
 else {
    Log.e(LOG_TAG,"String_Node_Str");
  }
  enableVibrating(true);
}

Fixed version (ground truth):
/** 
 * Start the ringing sound.
 * @param resId    the ring sound id
 * @param filename the filename to save the ringtone
 */
public void startRinging(int resId,String filename){
  Log.d(LOG_TAG,"String_Node_Str");
  stopSounds();
  mIsRinging=true;
  if (null != mRingTone) {
    Log.d(LOG_TAG,"String_Node_Str");
    return;
  }
  mRingTone=getRingTone(mContext,resId,filename,RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE));
  if (null != mRingTone) {
    setSpeakerphoneOn(false,true);
    mRingTone.play();
  }
 else {
    Log.e(LOG_TAG,"String_Node_Str");
  }
  enableVibrating(true);
}
Program: 31934
Project: 31934
Buggy source:
/** 
 * Indicate if replying to the provided event is supported. Only event of type Event.EVENT_TYPE_MESSAGE are supported for the moment
 * @param replyToEvent the event to reply to
 * @return true if it is possible to reply to this event
 */
public boolean canReplyTo(@Nullable Event replyToEvent){
  return replyToEvent != null && Event.EVENT_TYPE_MESSAGE.equals(replyToEvent.type);
}

Fixed version (ground truth):
/** 
 * Indicate if replying to the provided event is supported. Only event of type Event.EVENT_TYPE_MESSAGE are supported for the moment
 * @param replyToEvent the event to reply to
 * @return true if it is possible to reply to this event
 */
public boolean canReplyTo(@Nullable Event replyToEvent){
  return replyToEvent != null && Event.EVENT_TYPE_MESSAGE.equals(replyToEvent.getType());
}
Program: 31935
Project: 31935
Buggy source:
@Override public void onRetry(){
  getURLPreview(URL,ts,callback);
}

Fixed version (ground truth):
@Override public void onRetry(){
  getURLPreview(url,ts,callback);
}
Program: 31936
Project: 31936
Buggy source:
/** 
 * Retrieve the URL preview information.
 * @param URL      the URL
 * @param ts       the timestamp
 * @param callback the asynchronous callback
 */
public void getURLPreview(final String URL,final long ts,final ApiCallback<URLPreview> callback){
  final String description="String_Node_Str" + URL + "String_Node_Str"+ ts;
  mApi.getURLPreview(URL,ts).enqueue(new RestAdapterCallback<Map<String,Object>>(description,null,false,new SimpleApiCallback<Map<String,Object>>(callback){
    @Override public void onSuccess(    Map<String,Object> map){
      if (null != callback) {
        callback.onSuccess(new URLPreview(map));
      }
    }
  }
,new RestAdapterCallback.RequestRetryCallBack(){
    @Override public void onRetry(){
      getURLPreview(URL,ts,callback);
    }
  }
));
}

Fixed version (ground truth):
/** 
 * Retrieve the URL preview information.
 * @param url      the URL
 * @param ts       the timestamp
 * @param callback the asynchronous callback
 */
public void getURLPreview(final String url,final long ts,final ApiCallback<URLPreview> callback){
  final String description="String_Node_Str" + url + "String_Node_Str"+ ts;
  mApi.getURLPreview(url,ts).enqueue(new RestAdapterCallback<Map<String,Object>>(description,null,false,new SimpleApiCallback<Map<String,Object>>(callback){
    @Override public void onSuccess(    Map<String,Object> map){
      if (null != callback) {
        callback.onSuccess(new URLPreview(map,url));
      }
    }
  }
,new RestAdapterCallback.RequestRetryCallBack(){
    @Override public void onRetry(){
      getURLPreview(url,ts,callback);
    }
  }
));
}
Program: 31937
Project: 31937
Buggy source:
@Override public void onSuccess(Map<String,Object> map){
  if (null != callback) {
    callback.onSuccess(new URLPreview(map));
  }
}

Fixed version (ground truth):
@Override public void onSuccess(Map<String,Object> map){
  if (null != callback) {
    callback.onSuccess(new URLPreview(map,url));
  }
}
Program: 31938
Project: 31938
Buggy source:
/** 
 * Constructor
 * @param map the constructor parameters
 */
public URLPreview(Map<String,Object> map){
  mDescription=getAsString(map,OG_DESCRIPTION);
  mTitle=getAsString(map,OG_TITLE);
  mType=getAsString(map,OG_TYPE);
  mSiteName=getAsString(map,OG_SITE_NAME);
  mRequestedURL=getAsString(map,OG_URL);
  mThumbnailURL=getAsString(map,OG_IMAGE);
  mThumbnailMimeType=getAsString(map,OG_IMAGE_TYPE);
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param map the constructor parameters
 * @param url the original url, will be used if the map does not contain OG_URL field
 */
public URLPreview(Map<String,Object> map,String url){
  mDescription=JsonUtils.getAsString(map,OG_DESCRIPTION);
  mTitle=JsonUtils.getAsString(map,OG_TITLE);
  mType=JsonUtils.getAsString(map,OG_TYPE);
  mSiteName=JsonUtils.getAsString(map,OG_SITE_NAME);
  String requestedUrl=JsonUtils.getAsString(map,OG_URL);
  if (TextUtils.isEmpty(requestedUrl)) {
    mRequestedURL=url;
  }
 else {
    mRequestedURL=requestedUrl;
  }
  mThumbnailURL=JsonUtils.getAsString(map,OG_IMAGE);
  mThumbnailMimeType=JsonUtils.getAsString(map,OG_IMAGE_TYPE);
}
Program: 31939
Project: 31939
Buggy source:
/** 
 * Dispatch end of download
 */
private void dispatchOnDownloadComplete(){
  for (  IMXMediaDownloadListener callback : mDownloadListeners) {
    try {
      callback.onDownloadComplete(mUrl);
    }
 catch (    Exception e) {
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
    }
  }
}

Fixed version (ground truth):
/** 
 * Dispatch end of download
 */
private void dispatchOnDownloadComplete(){
  for (  IMXMediaDownloadListener callback : mDownloadListeners) {
    try {
      callback.onDownloadComplete(mDownloadId);
    }
 catch (    Exception e) {
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
    }
  }
}
Program: 31940
Project: 31940
Buggy source:
/** 
 * Dispatch error message.
 * @param jsonElement the Json error
 */
private void dispatchOnDownloadError(JsonElement jsonElement){
  for (  IMXMediaDownloadListener callback : mDownloadListeners) {
    try {
      callback.onDownloadError(mUrl,jsonElement);
    }
 catch (    Exception e) {
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
    }
  }
}

Fixed version (ground truth):
/** 
 * Dispatch error message.
 * @param jsonElement the Json error
 */
private void dispatchOnDownloadError(JsonElement jsonElement){
  for (  IMXMediaDownloadListener callback : mDownloadListeners) {
    try {
      callback.onDownloadError(mDownloadId,jsonElement);
    }
 catch (    Exception e) {
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
    }
  }
}
Program: 31942
Project: 31942
Buggy source:
/** 
 * Dispatch download cancel
 */
private void dispatchDownloadCancel(){
  for (  IMXMediaDownloadListener callback : mDownloadListeners) {
    try {
      callback.onDownloadCancel(mUrl);
    }
 catch (    Exception e) {
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
    }
  }
}

Fixed version (ground truth):
/** 
 * Dispatch download cancel
 */
private void dispatchDownloadCancel(){
  for (  IMXMediaDownloadListener callback : mDownloadListeners) {
    try {
      callback.onDownloadCancel(mDownloadId);
    }
 catch (    Exception e) {
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
    }
  }
}
Program: 31943
Project: 31943
Buggy source:
/** 
 * Dispatch start event to the callbacks.
 */
private void dispatchDownloadStart(){
  for (  IMXMediaDownloadListener callback : mDownloadListeners) {
    try {
      callback.onDownloadStart(mUrl);
    }
 catch (    Exception e) {
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
    }
  }
}

Fixed version (ground truth):
/** 
 * Dispatch start event to the callbacks.
 */
private void dispatchDownloadStart(){
  for (  IMXMediaDownloadListener callback : mDownloadListeners) {
    try {
      callback.onDownloadStart(mDownloadId);
    }
 catch (    Exception e) {
      Log.e(LOG_TAG,"String_Node_Str" + e.getMessage());
    }
  }
}