nus-yam/ex-repair huggingface dataset:
Program: 14556
Project: 14556
Buggy source:
public ReaderPhotoView(Context context,AttributeSet attrs){
  super(context,attrs);
  mImageView=new ImageView(context);
  LayoutParams paramsImg=new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
  paramsImg.addRule(CENTER_IN_PARENT);
  this.addView(mImageView,paramsImg);
  mProgress=new ProgressBar(context);
  LayoutParams paramsProgress=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  paramsProgress.addRule(CENTER_IN_PARENT);
  mProgress.setVisibility(View.GONE);
  this.addView(mProgress,paramsProgress);
  mTxtError=new WPTextView(context);
  LayoutParams paramsTxt=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  paramsTxt.addRule(CENTER_IN_PARENT);
  mTxtError.setGravity(Gravity.CENTER);
  mTxtError.setText(context.getString(R.string.reader_toast_err_view_image));
  mTxtError.setTextColor(context.getResources().getColor(R.color.grey_extra_light));
  mTxtError.setTextSize(TypedValue.COMPLEX_UNIT_PX,context.getResources().getDimensionPixelSize(R.dimen.text_sz_large));
  mTxtError.setVisibility(View.GONE);
  this.addView(mTxtError,paramsTxt);
}

Fixed version (ground truth):
public ReaderPhotoView(Context context,AttributeSet attrs){
  super(context,attrs);
  mImageView=new ImageView(context);
  LayoutParams paramsImg=new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
  paramsImg.addRule(CENTER_IN_PARENT);
  this.addView(mImageView,paramsImg);
  mTxtError=new WPTextView(context);
  LayoutParams paramsTxt=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  paramsTxt.addRule(CENTER_IN_PARENT);
  mTxtError.setGravity(Gravity.CENTER);
  mTxtError.setText(context.getString(R.string.reader_toast_err_view_image));
  mTxtError.setTextColor(context.getResources().getColor(R.color.grey_extra_light));
  mTxtError.setTextSize(TypedValue.COMPLEX_UNIT_PX,context.getResources().getDimensionPixelSize(R.dimen.text_sz_large));
  mTxtError.setVisibility(View.GONE);
  this.addView(mTxtError,paramsTxt);
  mProgress=new ProgressBar(context);
  LayoutParams paramsProgress=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  paramsProgress.addRule(CENTER_IN_PARENT);
  mProgress.setVisibility(View.GONE);
  this.addView(mProgress,paramsProgress);
}
Program: 14557
Project: 14557
Buggy source:
@Override protected void onDetachedFromWindow(){
  if (mImageContainer != null) {
    mImageContainer.cancelRequest();
    mImageView.setImageDrawable(null);
    mImageContainer=null;
  }
  super.onDetachedFromWindow();
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  if (mLoResContainer != null || mHiResContainer != null) {
    mImageView.setImageDrawable(null);
  }
  if (mLoResContainer != null) {
    mLoResContainer.cancelRequest();
    mLoResContainer=null;
  }
  if (mHiResContainer != null) {
    mHiResContainer.cancelRequest();
    mHiResContainer=null;
  }
  super.onDetachedFromWindow();
}
Program: 14558
Project: 14558
Buggy source:
private void handleResponse(ImageLoader.ImageContainer response,boolean isLoResResponse){
  if (response.getBitmap() != null) {
    mImageView.setImageBitmap(response.getBitmap());
    createAttacher(mImageView);
    if (isLoResResponse) {
      ReaderAnim.fadeIn(mImageView,ReaderAnim.Duration.MEDIUM);
      if (mPhotoListener != null) {
        mPhotoListener.onPhotoLoaded(mPosition);
      }
      getHiResImage();
    }
    AppLog.d(AppLog.T.READER,"String_Node_Str" + (isLoResResponse ? "String_Node_Str" : "String_Node_Str"));
  }
}

Fixed version (ground truth):
private void handleResponse(ImageContainer response,boolean isLoResResponse){
  if (response.getBitmap() != null) {
    mImageView.setImageBitmap(response.getBitmap());
    createAttacher(mImageView);
    if (isLoResResponse) {
      hideProgress();
      ReaderAnim.fadeIn(mImageView,ReaderAnim.Duration.SHORT);
      if (mPhotoListener != null) {
        mPhotoListener.onPhotoLoaded(mPosition);
      }
      loadHiResImage();
    }
    AppLog.d(AppLog.T.READER,"String_Node_Str" + (isLoResResponse ? "String_Node_Str" : "String_Node_Str"));
  }
 else {
    AppLog.w(AppLog.T.READER,"String_Node_Str" + (isLoResResponse ? "String_Node_Str" : "String_Node_Str"));
  }
}
Program: 14559
Project: 14559
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.reader_fragment_photo_viewer,container,false);
  mPhotoView=(ReaderPhotoView)view.findViewById(R.id.photo_view);
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  mPhotoView=new ReaderPhotoView(container.getContext());
  mPhotoView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT));
  return mPhotoView;
}
Program: 14560
Project: 14560
Buggy source:
/** 
 * @param loResImageUrl the url of the lo-res image to load
 * @param hiResImageUrl the url of the hi-res image to load
 * @param position the position of the image in ReaderPhotoViewerActivity
 * @param photoListener optional listener
 */
public void setImageUrl(String loResImageUrl,String hiResImageUrl,int position,ReaderPhotoListener photoListener){
  mLoResImageUrl=loResImageUrl;
  mHiResImageUrl=hiResImageUrl;
  mPosition=position;
  mPhotoListener=photoListener;
  loadImageIfNecessary(false);
}

Fixed version (ground truth):
/** 
 * @param imageUrl the url of the image to load
 * @param hiResWidth maximum width of the full-size image
 * @param isPrivate whether this is an image from a private blog
 * @param position the position of the image in ReaderPhotoViewerActivity
 * @param photoListener optional listener
 */
public void setImageUrl(String imageUrl,int hiResWidth,boolean isPrivate,int position,ReaderPhotoListener photoListener){
  int loResWidth=(int)(hiResWidth * 0.15f);
  if (isPrivate) {
    mLoResImageUrl=ReaderUtils.getPrivateImageForDisplay(imageUrl,loResWidth,0);
    mHiResImageUrl=ReaderUtils.getPrivateImageForDisplay(imageUrl,hiResWidth,0);
  }
 else {
    mLoResImageUrl=PhotonUtils.getPhotonImageUrl(imageUrl,loResWidth,0);
    mHiResImageUrl=PhotonUtils.getPhotonImageUrl(imageUrl,hiResWidth,0);
  }
  mPosition=position;
  mPhotoListener=photoListener;
  loadImageIfNecessary(false);
}
Program: 14561
Project: 14561
Buggy source:
private void showProgress(){
  if (mProgress != null) {
    mProgress.setVisibility(View.VISIBLE);
  }
}

Fixed version (ground truth):
private void showProgress(){
  if (mProgress != null) {
    mProgress.setVisibility(View.VISIBLE);
    mProgress.bringToFront();
  }
}
Program: 14562
Project: 14562
Buggy source:
private void getLoResImage(final boolean isInLayoutPass){
  showProgress();
  Point pt=DisplayUtils.getDisplayPixelSize(this.getContext());
  int maxSize=Math.min(pt.x,pt.y);
  mImageContainer=WordPress.imageLoader.get(mLoResImageUrl,new ImageLoader.ImageListener(){
    @Override public void onErrorResponse(    VolleyError error){
      AppLog.e(AppLog.T.READER,error);
      hideProgress();
      showError();
    }
    @Override public void onResponse(    final ImageLoader.ImageContainer response,    boolean isImmediate){
      hideProgress();
      if (isImmediate && isInLayoutPass) {
        post(new Runnable(){
          @Override public void run(){
            handleResponse(response,true);
          }
        }
);
      }
 else {
        handleResponse(response,true);
      }
    }
  }
,maxSize,maxSize);
}

Fixed version (ground truth):
private void getLoResImage(final boolean isInLayoutPass){
  Point pt=DisplayUtils.getDisplayPixelSize(this.getContext());
  int maxSize=Math.min(pt.x,pt.y);
  showProgress();
  mImageContainer=WordPress.imageLoader.get(mLoResImageUrl,new ImageLoader.ImageListener(){
    @Override public void onErrorResponse(    VolleyError error){
      AppLog.e(AppLog.T.READER,error);
      hideProgress();
      showError();
    }
    @Override public void onResponse(    final ImageLoader.ImageContainer response,    boolean isImmediate){
      if (isImmediate && isInLayoutPass) {
        post(new Runnable(){
          @Override public void run(){
            handleResponse(response,true);
            hideProgress();
          }
        }
);
      }
 else {
        handleResponse(response,true);
        hideProgress();
      }
    }
  }
,maxSize,maxSize);
}
Program: 14563
Project: 14563
Buggy source:
private void handleResponse(ImageLoader.ImageContainer response,boolean isLoResResponse){
  if (response.getBitmap() != null) {
    mImageView.setImageBitmap(response.getBitmap());
    if (isLoResResponse) {
      ReaderAnim.fadeIn(mImageView,ReaderAnim.Duration.MEDIUM);
      getHiResImage();
      if (mPhotoListener != null) {
        mPhotoListener.onPhotoLoaded(mPosition);
      }
    }
    createAttacher(mImageView);
  }
}

Fixed version (ground truth):
private void handleResponse(ImageLoader.ImageContainer response,boolean isLoResResponse){
  if (response.getBitmap() != null) {
    mImageView.setImageBitmap(response.getBitmap());
    createAttacher(mImageView);
    if (isLoResResponse) {
      ReaderAnim.fadeIn(mImageView,ReaderAnim.Duration.MEDIUM);
      if (mPhotoListener != null) {
        mPhotoListener.onPhotoLoaded(mPosition);
      }
      getHiResImage();
    }
    AppLog.d(AppLog.T.READER,"String_Node_Str" + (isLoResResponse ? "String_Node_Str" : "String_Node_Str"));
  }
}
Program: 14564
Project: 14564
Buggy source:
private void showImage(){
  if (!isAdded() || TextUtils.isEmpty(mImageUrl)) {
    return;
  }
  Point pt=DisplayUtils.getDisplayPixelSize(getActivity());
  int hiResWidth=Math.max(pt.x,pt.y);
  int loResWidth=(int)(hiResWidth * 0.10f);
  final String loResImageUrl;
  final String hiResImageUrl;
  if (mIsPrivate) {
    loResImageUrl=ReaderUtils.getPrivateImageForDisplay(mImageUrl,loResWidth,0);
    hiResImageUrl=ReaderUtils.getPrivateImageForDisplay(mImageUrl,hiResWidth,0);
  }
 else {
    loResImageUrl=PhotonUtils.getPhotonImageUrl(mImageUrl,loResWidth,0);
    hiResImageUrl=PhotonUtils.getPhotonImageUrl(mImageUrl,hiResWidth,0);
  }
  mPhotoView.setImageUrl(loResImageUrl,hiResImageUrl,mPosition,mPhotoListener);
}

Fixed version (ground truth):
private void showImage(){
  if (!isAdded() || TextUtils.isEmpty(mImageUrl)) {
    return;
  }
  Point pt=DisplayUtils.getDisplayPixelSize(getActivity());
  int hiResWidth=Math.max(pt.x,pt.y);
  mPhotoView.setImageUrl(mImageUrl,hiResWidth,mIsPrivate,mPosition,mPhotoListener);
}
Program: 14565
Project: 14565
Buggy source:
/** 
 * @param imageUrl the url of the image to load
 * @param hiResWidth maximum width of the full-size image
 * @param isPrivate whether this is an image from a private blog
 * @param position the position of the image in ReaderPhotoViewerActivity
 */
public void setImageUrl(String imageUrl,int hiResWidth,boolean isPrivate,int position){
  int loResWidth=(int)(hiResWidth * 0.15f);
  if (isPrivate) {
    mLoResImageUrl=ReaderUtils.getPrivateImageForDisplay(imageUrl,loResWidth,0);
    mHiResImageUrl=ReaderUtils.getPrivateImageForDisplay(imageUrl,hiResWidth,0);
  }
 else {
    mLoResImageUrl=PhotonUtils.getPhotonImageUrl(imageUrl,loResWidth,0);
    mHiResImageUrl=PhotonUtils.getPhotonImageUrl(imageUrl,hiResWidth,0);
  }
  mPosition=position;
  loadLoResImage(false);
}

Fixed version (ground truth):
/** 
 * @param imageUrl the url of the image to load
 * @param hiResWidth maximum width of the full-size image
 * @param isPrivate whether this is an image from a private blog
 * @param position the position of the image in ReaderPhotoViewerActivity
 */
public void setImageUrl(String imageUrl,int hiResWidth,boolean isPrivate,int position){
  int loResWidth=(int)(hiResWidth * 0.10f);
  if (isPrivate) {
    mLoResImageUrl=ReaderUtils.getPrivateImageForDisplay(imageUrl,loResWidth,0);
    mHiResImageUrl=ReaderUtils.getPrivateImageForDisplay(imageUrl,hiResWidth,0);
  }
 else {
    mLoResImageUrl=PhotonUtils.getPhotonImageUrl(imageUrl,loResWidth,0);
    mHiResImageUrl=PhotonUtils.getPhotonImageUrl(imageUrl,hiResWidth,0);
  }
  mPosition=position;
  loadLoResImage(false);
}
Program: 14566
Project: 14566
Buggy source:
private void loadLoResImage(final boolean isInLayoutPass){
  if (!hasLayout() || TextUtils.isEmpty(mLoResImageUrl)) {
    return;
  }
  if (isRequestingUrl(mLoResContainer,mLoResImageUrl)) {
    return;
  }
  AppLog.w(AppLog.T.READER,"String_Node_Str" + mPosition);
  Point pt=DisplayUtils.getDisplayPixelSize(this.getContext());
  int maxSize=Math.min(pt.x,pt.y);
  showProgress();
  mLoResContainer=WordPress.imageLoader.get(mLoResImageUrl,new ImageLoader.ImageListener(){
    @Override public void onErrorResponse(    VolleyError error){
      AppLog.e(AppLog.T.READER,error);
      hideProgress();
      showError();
    }
    @Override public void onResponse(    final ImageContainer response,    boolean isImmediate){
      if (isImmediate && isInLayoutPass) {
        post(new Runnable(){
          @Override public void run(){
            handleResponse(response,true);
          }
        }
);
      }
 else {
        handleResponse(response,true);
      }
    }
  }
,maxSize,maxSize);
}

Fixed version (ground truth):
private void loadLoResImage(final boolean isInLayoutPass){
  if (!hasLayout() || TextUtils.isEmpty(mLoResImageUrl)) {
    return;
  }
  if (isRequestingUrl(mLoResContainer,mLoResImageUrl)) {
    return;
  }
  AppLog.d(AppLog.T.READER,"String_Node_Str" + mPosition);
  showProgress();
  Point pt=DisplayUtils.getDisplayPixelSize(this.getContext());
  int maxSize=Math.min(pt.x,pt.y);
  mLoResContainer=WordPress.imageLoader.get(mLoResImageUrl,new ImageLoader.ImageListener(){
    @Override public void onErrorResponse(    VolleyError error){
      AppLog.e(AppLog.T.READER,error);
      hideProgress();
      showError();
    }
    @Override public void onResponse(    final ImageContainer response,    boolean isImmediate){
      if (isImmediate && isInLayoutPass) {
        post(new Runnable(){
          @Override public void run(){
            handleResponse(response,true);
          }
        }
);
      }
 else {
        handleResponse(response,true);
      }
    }
  }
,maxSize,maxSize);
}
Program: 14567
Project: 14567
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.reader_activity_photo_viewer);
  mViewPager=(ViewPager)findViewById(R.id.viewpager);
  mTxtTitle=(TextView)findViewById(R.id.text_title);
  if (savedInstanceState != null) {
    mInitialImageUrl=savedInstanceState.getString(ReaderConstants.ARG_IMAGE_URL);
    mIsPrivate=savedInstanceState.getBoolean(ReaderConstants.ARG_IS_PRIVATE);
    mContent=savedInstanceState.getString(ReaderConstants.ARG_CONTENT);
  }
 else   if (getIntent() != null) {
    mInitialImageUrl=getIntent().getStringExtra(ReaderConstants.ARG_IMAGE_URL);
    mIsPrivate=getIntent().getBooleanExtra(ReaderConstants.ARG_IS_PRIVATE,false);
    mContent=getIntent().getStringExtra(ReaderConstants.ARG_CONTENT);
  }
  mViewPager.setPageTransformer(false,new ReaderViewPagerTransformer(TransformType.FLOW));
  mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener(){
    @Override public void onPageSelected(    int position){
      updateTitle(position);
    }
  }
);
  loadImageList();
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.reader_activity_photo_viewer);
  mViewPager=(ViewPager)findViewById(R.id.viewpager);
  mTxtTitle=(TextView)findViewById(R.id.text_title);
  mTxtTitle.setVisibility(View.GONE);
  if (savedInstanceState != null) {
    mInitialImageUrl=savedInstanceState.getString(ReaderConstants.ARG_IMAGE_URL);
    mIsPrivate=savedInstanceState.getBoolean(ReaderConstants.ARG_IS_PRIVATE);
    mContent=savedInstanceState.getString(ReaderConstants.ARG_CONTENT);
  }
 else   if (getIntent() != null) {
    mInitialImageUrl=getIntent().getStringExtra(ReaderConstants.ARG_IMAGE_URL);
    mIsPrivate=getIntent().getBooleanExtra(ReaderConstants.ARG_IS_PRIVATE,false);
    mContent=getIntent().getStringExtra(ReaderConstants.ARG_CONTENT);
  }
  mViewPager.setPageTransformer(false,new ReaderViewPagerTransformer(TransformType.FLOW));
  mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener(){
    @Override public void onPageSelected(    int position){
      updateTitle(position);
    }
  }
);
  loadImageList();
}
Program: 14568
Project: 14568
Buggy source:
private void flagSuperProperty(String property){
  try {
    JSONObject superProperty=new JSONObject();
    superProperty.put(property,true);
    mMixpanel.registerSuperProperties(superProperty);
  }
 catch (  JSONException e) {
    AppLog.e(AppLog.T.UTILS,e);
  }
}

Fixed version (ground truth):
private void flagSuperProperty(String property){
  try {
    JSONObject superProperties=mMixpanel.getSuperProperties();
    superProperties.put(property,true);
    mMixpanel.registerSuperProperties(superProperties);
  }
 catch (  JSONException e) {
    AppLog.e(AppLog.T.UTILS,e);
  }
}
Program: 14569
Project: 14569
Buggy source:
private void incrementSuperProperty(String property){
  SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(WordPress.getContext());
  int propertyCount=preferences.getInt(property,0);
  propertyCount++;
  SharedPreferences.Editor editor=preferences.edit();
  editor.putInt(property,propertyCount);
  editor.commit();
  try {
    JSONObject superProperty=new JSONObject();
    superProperty.put(property,propertyCount);
    mMixpanel.registerSuperProperties(superProperty);
  }
 catch (  JSONException e) {
    AppLog.e(AppLog.T.UTILS,e);
  }
}

Fixed version (ground truth):
private void incrementSuperProperty(String property){
  SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(WordPress.getContext());
  int propertyCount=preferences.getInt(property,0);
  propertyCount++;
  SharedPreferences.Editor editor=preferences.edit();
  editor.putInt(property,propertyCount);
  editor.commit();
  try {
    JSONObject superProperties=mMixpanel.getSuperProperties();
    superProperties.put(property,propertyCount);
    mMixpanel.registerSuperProperties(superProperties);
  }
 catch (  JSONException e) {
    AppLog.e(AppLog.T.UTILS,e);
  }
}
Program: 14570
Project: 14570
Buggy source:
public void transformPage(View view,float position){
switch (mTransformType) {
case DEPTH:
    if (position <= -1) {
      view.setAlpha(0);
      view.setVisibility(View.INVISIBLE);
    }
 else     if (position <= 0) {
      view.setAlpha(1);
      view.setTranslationX(0);
      view.setScaleX(1);
      view.setScaleY(1);
      view.setVisibility(View.VISIBLE);
    }
 else     if (position <= 1) {
      view.setAlpha(1 - position);
      int pageWidth=view.getWidth();
      view.setTranslationX(pageWidth * -position);
      float scaleFactor=MIN_SCALE_DEPTH + (1 - MIN_SCALE_DEPTH) * (1 - Math.abs(position));
      view.setScaleX(scaleFactor);
      view.setScaleY(scaleFactor);
      if (position == 1) {
        view.setVisibility(View.INVISIBLE);
      }
 else {
        view.setVisibility(View.VISIBLE);
      }
    }
 else {
      view.setAlpha(0);
      view.setVisibility(View.INVISIBLE);
    }
  break;
case ZOOM:
if (position < -1) {
  view.setAlpha(0);
}
 else if (position <= 1) {
  int pageWidth=view.getWidth();
  int pageHeight=view.getHeight();
  float scaleFactor=Math.max(MIN_SCALE_ZOOM,1 - Math.abs(position));
  float vertMargin=pageHeight * (1 - scaleFactor) / 2;
  float horzMargin=pageWidth * (1 - scaleFactor) / 2;
  if (position < 0) {
    view.setTranslationX(horzMargin - vertMargin / 2);
  }
 else {
    view.setTranslationX(-horzMargin + vertMargin / 2);
  }
  view.setScaleX(scaleFactor);
  view.setScaleY(scaleFactor);
  view.setAlpha(MIN_ALPHA_ZOOM + (scaleFactor - MIN_SCALE_ZOOM) / (1 - MIN_SCALE_ZOOM) * (1 - MIN_ALPHA_ZOOM));
}
 else {
  view.setAlpha(0);
}
break;
}
}

Fixed version (ground truth):
public void transformPage(View view,float position){
  float alpha;
  float scale;
  float translationX;
switch (mTransformType) {
case DEPTH:
    if (position > 0 && position < 1) {
      alpha=(1 - position);
      scale=MIN_SCALE_DEPTH + (1 - MIN_SCALE_DEPTH) * (1 - Math.abs(position));
      translationX=(view.getWidth() * -position);
    }
 else {
      alpha=1;
      scale=1;
      translationX=0;
    }
  break;
case ZOOM:
if (position >= -1 && position <= 1) {
  scale=Math.max(MIN_SCALE_ZOOM,1 - Math.abs(position));
  alpha=MIN_ALPHA_ZOOM + (scale - MIN_SCALE_ZOOM) / (1 - MIN_SCALE_ZOOM) * (1 - MIN_ALPHA_ZOOM);
  float vMargin=view.getHeight() * (1 - scale) / 2;
  float hMargin=view.getWidth() * (1 - scale) / 2;
  if (position < 0) {
    translationX=(hMargin - vMargin / 2);
  }
 else {
    translationX=(-hMargin + vMargin / 2);
  }
}
 else {
  alpha=1;
  scale=1;
  translationX=0;
}
break;
default :
return;
}
view.setAlpha(alpha);
view.setTranslationX(translationX);
view.setScaleX(scale);
view.setScaleY(scale);
}
Program: 14571
Project: 14571
Buggy source:
public void transformPage(View view,float position){
  int pageWidth=view.getWidth();
  if (position < -1) {
    view.setAlpha(0);
  }
 else   if (position <= 0) {
    view.setAlpha(1);
    view.setTranslationX(0);
    view.setScaleX(1);
    view.setScaleY(1);
  }
 else   if (position <= 1) {
    view.setAlpha(1 - position);
    view.setTranslationX(pageWidth * -position);
    float scaleFactor=MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
    view.setScaleX(scaleFactor);
    view.setScaleY(scaleFactor);
  }
 else {
    view.setAlpha(0);
  }
}

Fixed version (ground truth):
public void transformPage(View view,float position){
  int pageWidth=view.getWidth();
  if (position < -1) {
    view.setAlpha(0);
  }
 else   if (position <= 0) {
    view.setAlpha(1);
    view.setTranslationX(0);
    view.setScaleX(1);
    view.setScaleY(1);
  }
 else   if (position <= 1) {
    view.setAlpha(1 - position);
    view.setTranslationX(pageWidth * -position);
    float scaleFactor=MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
    view.setScaleX(scaleFactor);
    view.setScaleY(scaleFactor);
  }
 else {
    view.setAlpha(0);
  }
  if (position == 0) {
    view.bringToFront();
  }
}
Program: 14572
Project: 14572
Buggy source:
public static ReaderPostDetailFragment newInstance(long blogId,long postId,ReaderPostListType postListType){
  AppLog.d(T.READER,"String_Node_Str");
  AnalyticsTracker.track(AnalyticsTracker.Stat.READER_OPENED_ARTICLE);
  Bundle args=new Bundle();
  args.putLong(ReaderConstants.ARG_BLOG_ID,blogId);
  args.putLong(ReaderConstants.ARG_POST_ID,postId);
  if (postListType != null) {
    args.putSerializable(ReaderConstants.ARG_POST_LIST_TYPE,postListType);
  }
  ReaderPostDetailFragment fragment=new ReaderPostDetailFragment();
  fragment.setArguments(args);
  return fragment;
}

Fixed version (ground truth):
public static ReaderPostDetailFragment newInstance(long blogId,long postId,ReaderPostListType postListType){
  AppLog.d(T.READER,"String_Node_Str");
  Bundle args=new Bundle();
  args.putLong(ReaderConstants.ARG_BLOG_ID,blogId);
  args.putLong(ReaderConstants.ARG_POST_ID,postId);
  if (postListType != null) {
    args.putSerializable(ReaderConstants.ARG_POST_LIST_TYPE,postListType);
  }
  ReaderPostDetailFragment fragment=new ReaderPostDetailFragment();
  fragment.setArguments(args);
  return fragment;
}
Program: 14574
Project: 14574
Buggy source:
@Override public void onItemClick(AdapterView<?> adapterView,View view,int position,long id){
  position-=mListView.getHeaderViewsCount();
  if (position >= 0 && mPostSelectedListener != null) {
    ReaderPost post=(ReaderPost)getPostAdapter().getItem(position);
    if (post != null) {
      mPostSelectedListener.onPostSelected(post.blogId,post.postId);
    }
  }
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> adapterView,View view,int position,long id){
  position-=mListView.getHeaderViewsCount();
  if (position >= 0 && mPostSelectedListener != null) {
    ReaderPost post=(ReaderPost)getPostAdapter().getItem(position);
    if (post != null) {
      AnalyticsTracker.track(AnalyticsTracker.Stat.READER_OPENED_ARTICLE);
      mPostSelectedListener.onPostSelected(post.blogId,post.postId);
    }
  }
}
Program: 14575
Project: 14575
Buggy source:
@Override public void onPageSelected(int position){
  super.onPageSelected(position);
  onRequestFullScreen(false);
}

Fixed version (ground truth):
@Override public void onPageSelected(int position){
  AnalyticsTracker.track(AnalyticsTracker.Stat.READER_OPENED_ARTICLE);
  super.onPageSelected(position);
  onRequestFullScreen(false);
}
Program: 14577
Project: 14577
Buggy source:
/** 
 * tbl_tag_updates routines
 */
public static String getTagNewestDate(ReaderTag tag){
  if (tag == null) {
    return "String_Node_Str";
  }
  String[] args={tag.getTagName(),Integer.toString(tag.tagType.toInt())};
  return SqlUtils.stringForQuery(ReaderDatabase.getReadableDb(),"String_Node_Str",args);
}

Fixed version (ground truth):
/** 
 * tbl_tag_updates routines
 */
public static String getTagNewestDate(ReaderTag tag){
  return getDateColumn(tag,"String_Node_Str");
}
Program: 14578
Project: 14578
Buggy source:
public static void setTagNewestDate(ReaderTag tag,String date){
  if (tag == null) {
    return;
  }
  ContentValues values=new ContentValues();
  values.put("String_Node_Str",tag.getTagName());
  values.put("String_Node_Str",tag.tagType.toInt());
  values.put("String_Node_Str",date);
  try {
    ReaderDatabase.getWritableDb().insertWithOnConflict("String_Node_Str",null,values,SQLiteDatabase.CONFLICT_REPLACE);
  }
 catch (  SQLException e) {
    AppLog.e(T.READER,e);
  }
}

Fixed version (ground truth):
public static void setTagNewestDate(ReaderTag tag,String date){
  setDateColumn(tag,"String_Node_Str",date);
}
Program: 14579
Project: 14579
Buggy source:
public static void setTagLastUpdated(ReaderTag tag,String date){
  if (tag == null) {
    return;
  }
  ContentValues values=new ContentValues();
  values.put("String_Node_Str",tag.getTagName());
  values.put("String_Node_Str",tag.tagType.toInt());
  values.put("String_Node_Str",date);
  try {
    ReaderDatabase.getWritableDb().insertWithOnConflict("String_Node_Str",null,values,SQLiteDatabase.CONFLICT_REPLACE);
  }
 catch (  SQLException e) {
    AppLog.e(T.READER,e);
  }
}

Fixed version (ground truth):
public static void setTagLastUpdated(ReaderTag tag,String date){
  setDateColumn(tag,"String_Node_Str",date);
}
Program: 14580
Project: 14580
Buggy source:
private static String getTagLastUpdated(ReaderTag tag){
  if (tag == null) {
    return "String_Node_Str";
  }
  String[] args={tag.getTagName(),Integer.toString(tag.tagType.toInt())};
  return SqlUtils.stringForQuery(ReaderDatabase.getReadableDb(),"String_Node_Str",args);
}

Fixed version (ground truth):
private static String getTagLastUpdated(ReaderTag tag){
  return getDateColumn(tag,"String_Node_Str");
}
Program: 14581
Project: 14581
Buggy source:
public static String getTagOldestDate(ReaderTag tag){
  if (tag == null) {
    return "String_Node_Str";
  }
  String[] args={tag.getTagName(),Integer.toString(tag.tagType.toInt())};
  return SqlUtils.stringForQuery(ReaderDatabase.getReadableDb(),"String_Node_Str",args);
}

Fixed version (ground truth):
public static String getTagOldestDate(ReaderTag tag){
  return getDateColumn(tag,"String_Node_Str");
}
Program: 14582
Project: 14582
Buggy source:
public static void setTagOldestDate(ReaderTag tag,String date){
  if (tag == null) {
    return;
  }
  ContentValues values=new ContentValues();
  values.put("String_Node_Str",tag.getTagName());
  values.put("String_Node_Str",tag.tagType.toInt());
  values.put("String_Node_Str",date);
  try {
    ReaderDatabase.getWritableDb().insertWithOnConflict("String_Node_Str",null,values,SQLiteDatabase.CONFLICT_REPLACE);
  }
 catch (  SQLException e) {
    AppLog.e(T.READER,e);
  }
}

Fixed version (ground truth):
public static void setTagOldestDate(ReaderTag tag,String date){
  setDateColumn(tag,"String_Node_Str",date);
}
Program: 14583
Project: 14583
Buggy source:
private static void setDateColumn(ReaderTag tag,String colName,String date){
  if (tag == null) {
    return;
  }
  String[] args={tag.getTagName(),Integer.toString(tag.tagType.toInt())};
  boolean rowExists=SqlUtils.boolForQuery(ReaderDatabase.getReadableDb(),"String_Node_Str",args);
  final String sql;
  if (rowExists) {
    sql="String_Node_Str" + colName + "String_Node_Str";
  }
 else {
    sql="String_Node_Str" + colName + "String_Node_Str"+ colName+ "String_Node_Str";
  }
  SQLiteStatement stmt=ReaderDatabase.getWritableDb().compileStatement(sql);
  try {
    stmt.bindString(1,date);
    stmt.bindString(2,tag.getTagName());
    stmt.bindLong(3,tag.tagType.toInt());
    stmt.execute();
  }
  finally {
    SqlUtils.closeStatement(stmt);
  }
}

Fixed version (ground truth):
private static void setDateColumn(ReaderTag tag,String colName,String date){
  if (tag == null) {
    return;
  }
  String[] args={tag.getTagName(),Integer.toString(tag.tagType.toInt())};
  boolean rowExists=SqlUtils.boolForQuery(ReaderDatabase.getReadableDb(),"String_Node_Str",args);
  final String sql;
  if (rowExists) {
    sql="String_Node_Str" + colName + "String_Node_Str";
  }
 else {
    sql="String_Node_Str" + colName + "String_Node_Str";
  }
  SQLiteStatement stmt=ReaderDatabase.getWritableDb().compileStatement(sql);
  try {
    stmt.bindString(1,date);
    stmt.bindString(2,tag.getTagName());
    stmt.bindLong(3,tag.tagType.toInt());
    stmt.execute();
  }
  finally {
    SqlUtils.closeStatement(stmt);
  }
}
Program: 14584
Project: 14584
Buggy source:
@Override protected void onMessage(Context context,Intent intent){
  AppLog.v(T.NOTIFS,"String_Node_Str");
  Bundle extras=intent.getExtras();
  if (extras == null) {
    AppLog.v(T.NOTIFS,"String_Node_Str");
    return;
  }
  if (TextUtils.equals(extras.getString("String_Node_Str"),"String_Node_Str")) {
    HelpshiftHelper.getInstance().handlePush(context,intent);
    return;
  }
  if (extras.containsKey("String_Node_Str")) {
    String mpMessage=intent.getExtras().getString("String_Node_Str");
    String title=getString(R.string.app_name);
    Intent resultIntent=new Intent(this,PostsActivity.class);
    PendingIntent pendingIntent=PendingIntent.getActivity(this,0,resultIntent,PendingIntent.FLAG_UPDATE_CURRENT);
    AnalyticsTrackerMixpanel.showNotification(context,pendingIntent,R.drawable.notification_icon,title,mpMessage);
  }
  if (!WordPress.hasValidWPComCredentials(context)) {
    return;
  }
  handleDefaultPush(context,extras);
}

Fixed version (ground truth):
@Override protected void onMessage(Context context,Intent intent){
  AppLog.v(T.NOTIFS,"String_Node_Str");
  Bundle extras=intent.getExtras();
  if (extras == null) {
    AppLog.v(T.NOTIFS,"String_Node_Str");
    return;
  }
  if (TextUtils.equals(extras.getString("String_Node_Str"),"String_Node_Str")) {
    HelpshiftHelper.getInstance().handlePush(context,intent);
    return;
  }
  if (extras.containsKey("String_Node_Str")) {
    String mpMessage=intent.getExtras().getString("String_Node_Str");
    String title=getString(R.string.app_name);
    Intent resultIntent=new Intent(this,PostsActivity.class);
    PendingIntent pendingIntent=PendingIntent.getActivity(this,0,resultIntent,PendingIntent.FLAG_UPDATE_CURRENT);
    AnalyticsTrackerMixpanel.showNotification(context,pendingIntent,R.drawable.notification_icon,title,mpMessage);
    return;
  }
  if (!WordPress.hasValidWPComCredentials(context)) {
    return;
  }
  handleDefaultPush(context,extras);
}
Program: 14585
Project: 14585
Buggy source:
@Override public void drawSeries(Canvas canvas,GraphViewDataInterface[] values,float graphwidth,float graphheight,float border,double minX,double minY,double diffX,double diffY,float horstart,GraphViewSeriesStyle style){
  float colwidth=graphwidth / values.length;
  paint.setStrokeWidth(style.thickness);
  paint.setColor(style.color);
  List<BarChartRect> barChartRects=new LinkedList<BarChartRect>();
  for (int i=0; i < values.length; i++) {
    float valY=(float)(values[i].getY() - minY);
    float ratY=(float)(valY / diffY);
    float y=graphheight * ratY;
    if (style.getValueDependentColor() != null) {
      paint.setColor(style.getValueDependentColor().get(values[i]));
    }
    if (barPositionToHighlight == i) {
      int color;
      if (style.color == getResources().getColor(R.color.stats_bar_graph_views)) {
        color=getResources().getColor(R.color.orange_medium);
      }
 else {
        color=getResources().getColor(R.color.orange_dark);
      }
      paint.setColor(color);
    }
 else {
      paint.setColor(style.color);
    }
    float pad=style.padding;
    float left=(i * colwidth) + horstart;
    float top=(border - y) + graphheight;
    float right=left + colwidth;
    float bottom=graphheight + border - 1;
    canvas.drawRect(left + pad,top,right - pad,bottom,paint);
    barChartRects.add(new BarChartRect(left + pad,top,right - pad,bottom));
  }
  seriesRectsDrawedOnScreen.add(barChartRects);
}

Fixed version (ground truth):
@Override public void drawSeries(Canvas canvas,GraphViewDataInterface[] values,float graphwidth,float graphheight,float border,double minX,double minY,double diffX,double diffY,float horstart,GraphViewSeriesStyle style){
  float colwidth=graphwidth / values.length;
  paint.setStrokeWidth(style.thickness);
  paint.setColor(style.color);
  List<BarChartRect> barChartRects=new LinkedList<BarChartRect>();
  for (int i=0; i < values.length; i++) {
    float valY=(float)(values[i].getY() - minY);
    float ratY=(float)(valY / diffY);
    float y=graphheight * ratY;
    if (style.getValueDependentColor() != null) {
      paint.setColor(style.getValueDependentColor().get(values[i]));
    }
    if (mBarPositionToHighlight == i) {
      int color;
      if (style.color == getResources().getColor(R.color.stats_bar_graph_views)) {
        color=getResources().getColor(R.color.orange_medium);
      }
 else {
        color=getResources().getColor(R.color.orange_dark);
      }
      paint.setColor(color);
    }
 else {
      paint.setColor(style.color);
    }
    float pad=style.padding;
    float left=(i * colwidth) + horstart;
    float top=(border - y) + graphheight;
    float right=left + colwidth;
    float bottom=graphheight + border - 1;
    canvas.drawRect(left + pad,top,right - pad,bottom,paint);
    barChartRects.add(new BarChartRect(left + pad,top,right - pad,bottom));
  }
  mSeriesRectsDrawedOnScreen.add(barChartRects);
}
Program: 14586
Project: 14586
Buggy source:
public boolean isPointInside(float x,float y){
  if (x >= this.left && x <= this.right && y <= this.bottom && y >= this.top) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean isPointInside(float x,float y){
  if (x >= this.mLeft && x <= this.mRight && y <= this.mBottom && y >= this.mTop) {
    return true;
  }
  return false;
}
Program: 14587
Project: 14587
Buggy source:
BarChartRect(float left,float top,float right,float bottom){
  this.left=left;
  this.top=top;
  this.right=right;
  this.bottom=bottom;
}

Fixed version (ground truth):
BarChartRect(float left,float top,float right,float bottom){
  this.mLeft=left;
  this.mTop=top;
  this.mRight=right;
  this.mBottom=bottom;
}
Program: 14588
Project: 14588
Buggy source:
@Override public String formatLabel(double value,boolean isValueX){
  if (isValueX)   return null;
  if (value < 1000) {
    return null;
  }
 else   if (value < 1000000) {
    return Math.round(value / 1000) + "String_Node_Str";
  }
 else   if (value < 1000000000) {
    return Math.round(value / 1000000) + "String_Node_Str";
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public String formatLabel(double value,boolean isValueX){
  if (isValueX) {
    return null;
  }
  if (value < 1000) {
    return null;
  }
 else   if (value < 1000000) {
    return Math.round(value / 1000) + "String_Node_Str";
  }
 else   if (value < 1000000000) {
    return Math.round(value / 1000000) + "String_Node_Str";
  }
 else {
    return null;
  }
}
Program: 14589
Project: 14589
Buggy source:
private void setProperties(){
  getGraphViewStyle().setHorizontalLabelsColor(Color.BLACK);
  getGraphViewStyle().setVerticalLabelsColor(Color.BLACK);
  getGraphViewStyle().setTextSize(getResources().getDimensionPixelSize(R.dimen.graph_font_size));
  getGraphViewStyle().setGridXColor(Color.TRANSPARENT);
  getGraphViewStyle().setGridYColor(getResources().getColor(R.color.stats_bar_graph_grid));
  getGraphViewStyle().setNumVerticalLabels(6);
  setCustomLabelFormatter(new CustomLabelFormatter(){
    @Override public String formatLabel(    double value,    boolean isValueX){
      if (isValueX)       return null;
      if (value < 1000) {
        return null;
      }
 else       if (value < 1000000) {
        return Math.round(value / 1000) + "String_Node_Str";
      }
 else       if (value < 1000000000) {
        return Math.round(value / 1000000) + "String_Node_Str";
      }
 else {
        return null;
      }
    }
  }
);
}

Fixed version (ground truth):
private void setProperties(){
  getGraphViewStyle().setHorizontalLabelsColor(Color.BLACK);
  getGraphViewStyle().setVerticalLabelsColor(Color.BLACK);
  getGraphViewStyle().setTextSize(getResources().getDimensionPixelSize(R.dimen.graph_font_size));
  getGraphViewStyle().setGridXColor(Color.TRANSPARENT);
  getGraphViewStyle().setGridYColor(getResources().getColor(R.color.stats_bar_graph_grid));
  getGraphViewStyle().setNumVerticalLabels(6);
  setCustomLabelFormatter(new CustomLabelFormatter(){
    @Override public String formatLabel(    double value,    boolean isValueX){
      if (isValueX) {
        return null;
      }
      if (value < 1000) {
        return null;
      }
 else       if (value < 1000000) {
        return Math.round(value / 1000) + "String_Node_Str";
      }
 else       if (value < 1000000000) {
        return Math.round(value / 1000000) + "String_Node_Str";
      }
 else {
        return null;
      }
    }
  }
);
}
Program: 14590
Project: 14590
Buggy source:
public int getTappedBar(){
  float[] lastBarChartTouchedPoint=this.getLastTouchedPointOnCanvasAndReset();
  if (lastBarChartTouchedPoint[0] == 0f && lastBarChartTouchedPoint[1] == 0f) {
    return -1;
  }
  for (  List<BarChartRect> currentSerieChartRects : seriesRectsDrawedOnScreen) {
    int i=0;
    for (    BarChartRect barChartRect : currentSerieChartRects) {
      if (barChartRect.isPointInside(lastBarChartTouchedPoint[0],lastBarChartTouchedPoint[1])) {
        return i;
      }
      i++;
    }
  }
  return -1;
}

Fixed version (ground truth):
public int getTappedBar(){
  float[] lastBarChartTouchedPoint=this.getLastTouchedPointOnCanvasAndReset();
  if (lastBarChartTouchedPoint[0] == 0f && lastBarChartTouchedPoint[1] == 0f) {
    return -1;
  }
  for (  List<BarChartRect> currentSerieChartRects : mSeriesRectsDrawedOnScreen) {
    int i=0;
    for (    BarChartRect barChartRect : currentSerieChartRects) {
      if (barChartRect.isPointInside(lastBarChartTouchedPoint[0],lastBarChartTouchedPoint[1])) {
        return i;
      }
      i++;
    }
  }
  return -1;
}
Program: 14591
Project: 14591
Buggy source:
@Override protected double getMaxY(){
  double maxY=super.getMaxY();
  final int divideBy;
  if (maxY < 100)   divideBy=10;
 else   if (maxY < 1000)   divideBy=100;
 else   if (maxY < 10000)   divideBy=1000;
 else   if (maxY < 100000)   divideBy=10000;
 else   if (maxY < 1000000)   divideBy=100000;
 else   divideBy=1000000;
  maxY=Math.rint((maxY / divideBy) + 1) * divideBy;
  return maxY;
}

Fixed version (ground truth):
@Override protected double getMaxY(){
  double maxY=super.getMaxY();
  final int divideBy;
  if (maxY < 100) {
    divideBy=10;
  }
 else   if (maxY < 1000) {
    divideBy=100;
  }
 else   if (maxY < 10000) {
    divideBy=1000;
  }
 else   if (maxY < 100000) {
    divideBy=10000;
  }
 else   if (maxY < 1000000) {
    divideBy=100000;
  }
 else {
    divideBy=1000000;
  }
  maxY=Math.rint((maxY / divideBy) + 1) * divideBy;
  return maxY;
}
Program: 14592
Project: 14592
Buggy source:
@Override public void run(){
  barPositionToHighlight=-1;
  redrawAll();
}

Fixed version (ground truth):
@Override public void run(){
  mBarPositionToHighlight=-1;
  redrawAll();
}
Program: 14593
Project: 14593
Buggy source:
/** 
 * @param canvas
 */
@Override protected void onDraw(Canvas canvas){
  seriesRectsDrawedOnScreen.clear();
  super.onDraw(canvas);
}

Fixed version (ground truth):
/** 
 * @param canvas
 */
@Override protected void onDraw(Canvas canvas){
  mSeriesRectsDrawedOnScreen.clear();
  super.onDraw(canvas);
}
Program: 14594
Project: 14594
Buggy source:
public void highlightBar(int barPosition){
  barPositionToHighlight=barPosition;
  if (barPositionToHighlight == -1) {
    return;
  }
  this.redrawAll();
  final Handler handler=new Handler();
  handler.postDelayed(new Runnable(){
    @Override public void run(){
      barPositionToHighlight=-1;
      redrawAll();
    }
  }
,500);
}

Fixed version (ground truth):
public void highlightBar(int barPosition){
  mBarPositionToHighlight=barPosition;
  if (mBarPositionToHighlight == -1) {
    return;
  }
  this.redrawAll();
  final Handler handler=new Handler();
  handler.postDelayed(new Runnable(){
    @Override public void run(){
      mBarPositionToHighlight=-1;
      redrawAll();
    }
  }
,500);
}
Program: 14596
Project: 14596
Buggy source:
private void refreshSummary(final StatsSummary stats){
  if (getActivity() == null)   return;
  if (stats == null) {
    mVisitorsToday.setText("String_Node_Str");
    mViewsToday.setText("String_Node_Str");
    mViewsBestEver.setText("String_Node_Str");
    mViewsAllTime.setText("String_Node_Str");
    mCommentsAllTime.setText("String_Node_Str");
  }
 else {
    mVisitorsToday.setText(FormatUtils.formatDecimal(stats.getVisitorsToday()));
    mViewsToday.setText(FormatUtils.formatDecimal(stats.getViewsToday()));
    mViewsBestEver.setText(FormatUtils.formatDecimal(stats.getViewsBestDayTotal()));
    mViewsAllTime.setText(FormatUtils.formatDecimal(stats.getViewsAllTime()));
    mCommentsAllTime.setText(FormatUtils.formatDecimal(stats.getCommentsAllTime()));
  }
}

Fixed version (ground truth):
private void refreshSummary(final StatsSummary stats){
  if (getActivity() == null) {
    return;
  }
  if (stats == null) {
    mVisitorsToday.setText("String_Node_Str");
    mViewsToday.setText("String_Node_Str");
    mViewsBestEver.setText("String_Node_Str");
    mViewsAllTime.setText("String_Node_Str");
    mCommentsAllTime.setText("String_Node_Str");
  }
 else {
    mVisitorsToday.setText(FormatUtils.formatDecimal(stats.getVisitorsToday()));
    mViewsToday.setText(FormatUtils.formatDecimal(stats.getViewsToday()));
    mViewsBestEver.setText(FormatUtils.formatDecimal(stats.getViewsBestDayTotal()));
    mViewsAllTime.setText(FormatUtils.formatDecimal(stats.getViewsAllTime()));
    mCommentsAllTime.setText(FormatUtils.formatDecimal(stats.getCommentsAllTime()));
  }
}
Program: 14597
Project: 14597
Buggy source:
@Override public boolean onOptionsItemSelected(final MenuItem item){
  if (mWebView == null)   return false;
  int itemID=item.getItemId();
  if (itemID == R.id.menu_refresh) {
    mWebView.reload();
    return true;
  }
 else   if (itemID == R.id.menu_share) {
    Intent share=new Intent(Intent.ACTION_SEND);
    share.setType("String_Node_Str");
    share.putExtra(Intent.EXTRA_TEXT,mWebView.getUrl());
    startActivity(Intent.createChooser(share,getResources().getText(R.string.share_link)));
    return true;
  }
 else   if (itemID == R.id.menu_browser) {
    String url=mWebView.getUrl();
    if (url != null) {
      Uri uri=Uri.parse(url);
      if (uri != null) {
        Intent i=new Intent(Intent.ACTION_VIEW);
        i.setData(uri);
        startActivity(i);
        AppLockManager.getInstance().setExtendedTimeout();
      }
    }
    return true;
  }
  return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(final MenuItem item){
  if (mWebView == null) {
    return false;
  }
  int itemID=item.getItemId();
  if (itemID == R.id.menu_refresh) {
    mWebView.reload();
    return true;
  }
 else   if (itemID == R.id.menu_share) {
    Intent share=new Intent(Intent.ACTION_SEND);
    share.setType("String_Node_Str");
    share.putExtra(Intent.EXTRA_TEXT,mWebView.getUrl());
    startActivity(Intent.createChooser(share,getResources().getText(R.string.share_link)));
    return true;
  }
 else   if (itemID == R.id.menu_browser) {
    String url=mWebView.getUrl();
    if (url != null) {
      Uri uri=Uri.parse(url);
      if (uri != null) {
        Intent i=new Intent(Intent.ACTION_VIEW);
        i.setData(uri);
        startActivity(i);
        AppLockManager.getInstance().setExtendedTimeout();
      }
    }
    return true;
  }
  return super.onOptionsItemSelected(item);
}
Program: 14598
Project: 14598
Buggy source:
@Override public Loader<Cursor> onCreateLoader(int id,Bundle args){
  if (WordPress.getCurrentBlog() == null)   return null;
  String blogId=WordPress.getCurrentBlog().getDotComBlogId();
  if (TextUtils.isEmpty(blogId))   blogId="String_Node_Str";
  StatsBarChartUnit unit=getBarChartUnit();
  return new CursorLoader(getActivity(),StatsContentProvider.STATS_BAR_CHART_DATA_URI,null,"String_Node_Str",new String[]{blogId,unit.name()},null);
}

Fixed version (ground truth):
@Override public Loader<Cursor> onCreateLoader(int id,Bundle args){
  if (WordPress.getCurrentBlog() == null) {
    return null;
  }
  String blogId=WordPress.getCurrentBlog().getDotComBlogId();
  if (TextUtils.isEmpty(blogId)) {
    blogId="String_Node_Str";
  }
  StatsBarChartUnit unit=getBarChartUnit();
  return new CursorLoader(getActivity(),StatsContentProvider.STATS_BAR_CHART_DATA_URI,null,"String_Node_Str",new String[]{blogId,unit.name()},null);
}
Program: 14599
Project: 14599
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
  if (StatsActivity.STATS_TOUCH_DETECTED.equals(action)) {
    int tappedBar;
    if (graphView != null && (tappedBar=graphView.getTappedBar()) != -1) {
      graphView.highlightBar(tappedBar);
      handleBarChartTap(tappedBar);
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
  if (StatsActivity.STATS_TOUCH_DETECTED.equals(action)) {
    int tappedBar;
    if (mGraphView != null && (tappedBar=mGraphView.getTappedBar()) != -1) {
      mGraphView.highlightBar(tappedBar);
      handleBarChartTap(tappedBar);
    }
  }
}
Program: 14600
Project: 14600
Buggy source:
private int getNumOfPoints(){
  if (hasActivity() && DisplayUtils.isTablet(getActivity())) {
    return 30;
  }
  if (getBarChartUnit() == StatsBarChartUnit.DAY)   return 7;
 else   return 12;
}

Fixed version (ground truth):
private int getNumOfPoints(){
  if (hasActivity() && DisplayUtils.isTablet(getActivity())) {
    return 30;
  }
  if (getBarChartUnit() == StatsBarChartUnit.DAY) {
    return 7;
  }
 else {
    return 12;
  }
}
Program: 14603
Project: 14603
Buggy source:
private int getNumOfHorizontalLabels(int numPoints){
  if (hasActivity() && DisplayUtils.isTablet(getActivity())) {
    return numPoints / 5;
  }
  if (getBarChartUnit() == StatsBarChartUnit.DAY)   return numPoints / 2;
 else   return numPoints / 3;
}

Fixed version (ground truth):
private int getNumOfHorizontalLabels(int numPoints){
  if (hasActivity() && DisplayUtils.isTablet(getActivity())) {
    return numPoints / 5;
  }
  if (getBarChartUnit() == StatsBarChartUnit.DAY) {
    return numPoints / 2;
  }
 else {
    return numPoints / 3;
  }
}