nus-yam/ex-repair huggingface dataset:
Program: 14392
Project: 14392
Buggy source:
@Override public void onErrorResponse(final VolleyError volleyError){
  singleThreadNetworkHandler.submit(new Thread(){
    @Override public void run(){
      AppLog.e(T.STATS,this.getClass().getName() + "String_Node_Str");
      StatsUtils.logVolleyErrorDetails(volleyError);
      mResponseObjectModel=volleyError;
      EventBus.getDefault().post(new StatsEvents.SectionUpdated(mEndpointName,mRequestBlogId,mTimeframe,mDate,mResponseObjectModel));
      checkAllRequestsFinished();
    }
  }
);
}

Fixed version (ground truth):
@Override public void onErrorResponse(final VolleyError volleyError){
  singleThreadNetworkHandler.submit(new Thread(){
    @Override public void run(){
      AppLog.e(T.STATS,this.getClass().getName() + "String_Node_Str");
      StatsUtils.logVolleyErrorDetails(volleyError);
      mResponseObjectModel=volleyError;
      EventBus.getDefault().post(new StatsEvents.SectionUpdated(mEndpointName,mRequestBlogId,mTimeframe,mDate,mResponseObjectModel));
      checkAllRequestsFinished(currentRequest);
    }
  }
);
}
Program: 14393
Project: 14393
Buggy source:
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
switch (requestCode) {
case RequestCodes.READER_SUBS:
case RequestCodes.READER_REBLOG:
    ReaderPostListFragment readerFragment=getReaderListFragment();
  if (readerFragment != null) {
  }
break;
case RequestCodes.ADD_ACCOUNT:
if (resultCode == RESULT_OK) {
WordPress.registerForCloudMessaging(this);
}
 else {
finish();
}
break;
case RequestCodes.REAUTHENTICATE:
if (resultCode == RESULT_CANCELED) {
ActivityLauncher.showSignInForResult(this);
}
 else {
WordPress.registerForCloudMessaging(this);
}
break;
case RequestCodes.SETTINGS:
if (AccountHelper.isSignedIn()) {
WordPress.registerForCloudMessaging(this);
}
 else {
ActivityLauncher.showSignInForResult(this);
}
break;
case RequestCodes.SITE_PICKER:
if (resultCode == RESULT_OK && data != null) {
int localId=data.getIntExtra(SitePickerActivity.KEY_LOCAL_ID,0);
Blog blog=WordPress.setCurrentBlog(localId);
WordPress.wpDB.updateLastBlogId(localId);
MySiteFragment mySiteFragment=getMySiteFragment();
if (mySiteFragment != null) {
mySiteFragment.setBlog(blog);
}
}
break;
}
}

Fixed version (ground truth):
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
switch (requestCode) {
case RequestCodes.READER_SUBS:
case RequestCodes.READER_REBLOG:
    ReaderPostListFragment readerFragment=getReaderListFragment();
  if (readerFragment != null) {
  }
break;
case RequestCodes.ADD_ACCOUNT:
if (resultCode == RESULT_OK) {
WordPress.registerForCloudMessaging(this);
}
 else {
finish();
}
break;
case RequestCodes.REAUTHENTICATE:
if (resultCode == RESULT_CANCELED) {
ActivityLauncher.showSignInForResult(this);
}
 else {
WordPress.registerForCloudMessaging(this);
}
break;
case RequestCodes.SETTINGS:
if (AccountHelper.isSignedIn()) {
WordPress.registerForCloudMessaging(this);
}
 else {
ActivityLauncher.showSignInForResult(this);
}
break;
case RequestCodes.NOTE_DETAIL:
if (getNotificationListFragment() != null) {
getNotificationListFragment().onActivityResult(requestCode,resultCode,data);
}
break;
case RequestCodes.SITE_PICKER:
if (resultCode == RESULT_OK && data != null) {
int localId=data.getIntExtra(SitePickerActivity.KEY_LOCAL_ID,0);
Blog blog=WordPress.setCurrentBlog(localId);
WordPress.wpDB.updateLastBlogId(localId);
MySiteFragment mySiteFragment=getMySiteFragment();
if (mySiteFragment != null) {
mySiteFragment.setBlog(blog);
}
}
break;
}
}
Program: 14394
Project: 14394
Buggy source:
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == NOTE_DETAIL_REQUEST_CODE && resultCode == Activity.RESULT_OK && data != null) {
    if (SimperiumUtils.getNotesBucket() == null)     return;
    try {
      Note note=SimperiumUtils.getNotesBucket().get(StringUtils.notNullStr(data.getStringExtra(NOTE_MODERATE_ID_EXTRA)));
      CommentStatus commentStatus=CommentStatus.fromString(data.getStringExtra(NOTE_MODERATE_STATUS_EXTRA));
      moderateCommentForNote(note,commentStatus);
    }
 catch (    BucketObjectMissingException e) {
      e.printStackTrace();
    }
  }
  super.onActivityResult(requestCode,resultCode,data);
}

Fixed version (ground truth):
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == RequestCodes.NOTE_DETAIL && resultCode == Activity.RESULT_OK && data != null) {
    if (SimperiumUtils.getNotesBucket() == null)     return;
    try {
      Note note=SimperiumUtils.getNotesBucket().get(StringUtils.notNullStr(data.getStringExtra(NOTE_MODERATE_ID_EXTRA)));
      CommentStatus commentStatus=CommentStatus.fromString(data.getStringExtra(NOTE_MODERATE_STATUS_EXTRA));
      moderateCommentForNote(note,commentStatus);
    }
 catch (    BucketObjectMissingException e) {
      e.printStackTrace();
    }
  }
  super.onActivityResult(requestCode,resultCode,data);
}
Program: 14395
Project: 14395
Buggy source:
/** 
 * Open a note fragment based on the type of note
 */
public static void openNote(Activity activity,final String noteId,boolean shouldShowKeyboard){
  if (noteId == null || activity == null) {
    return;
  }
  Intent detailIntent=new Intent(activity,NotificationsDetailActivity.class);
  detailIntent.putExtra(NOTE_ID_EXTRA,noteId);
  detailIntent.putExtra(NOTE_INSTANT_REPLY_EXTRA,shouldShowKeyboard);
  ActivityOptionsCompat options=ActivityOptionsCompat.makeCustomAnimation(activity,R.anim.reader_activity_slide_in,R.anim.do_nothing);
  ActivityCompat.startActivityForResult(activity,detailIntent,NOTE_DETAIL_REQUEST_CODE,options.toBundle());
  AnalyticsTracker.track(AnalyticsTracker.Stat.NOTIFICATIONS_OPENED_NOTIFICATION_DETAILS);
}

Fixed version (ground truth):
/** 
 * Open a note fragment based on the type of note
 */
public static void openNote(Activity activity,final String noteId,boolean shouldShowKeyboard){
  if (noteId == null || activity == null) {
    return;
  }
  Intent detailIntent=new Intent(activity,NotificationsDetailActivity.class);
  detailIntent.putExtra(NOTE_ID_EXTRA,noteId);
  detailIntent.putExtra(NOTE_INSTANT_REPLY_EXTRA,shouldShowKeyboard);
  ActivityOptionsCompat options=ActivityOptionsCompat.makeCustomAnimation(activity,R.anim.reader_activity_slide_in,R.anim.do_nothing);
  ActivityCompat.startActivityForResult(activity,detailIntent,RequestCodes.NOTE_DETAIL,options.toBundle());
  AnalyticsTracker.track(AnalyticsTracker.Stat.NOTIFICATIONS_OPENED_NOTIFICATION_DETAILS);
}
Program: 14396
Project: 14396
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    getWindow().setStatusBarColor(getResources().getColor(R.color.status_bar_tint));
  }
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  mViewPager=(WPMainViewPager)findViewById(R.id.viewpager_main);
  mTabAdapter=new WPMainTabAdapter(getFragmentManager());
  mViewPager.setAdapter(mTabAdapter);
  mTabs=(SlidingTabLayout)findViewById(R.id.sliding_tabs);
  mTabs.setSelectedIndicatorColors(getResources().getColor(R.color.tab_indicator));
  mTabs.setDistributeEvenly(true);
  Integer icons[]={R.drawable.main_tab_sites,R.drawable.main_tab_reader,R.drawable.main_tab_me,R.drawable.main_tab_notifications};
  mTabs.setCustomTabView(R.layout.tab_icon,R.id.tab_icon,R.id.tab_badge,icons);
  mTabs.setViewPager(mViewPager);
  mTabs.setOnPageChangeListener(this);
  if (savedInstanceState == null) {
    if (showSignInIfRequired()) {
      int position=AppPrefs.getMainTabIndex();
      if (mTabAdapter.isValidPosition(position) && position != mViewPager.getCurrentItem()) {
        mViewPager.setCurrentItem(position);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  setStatusBarColor();
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  mViewPager=(WPMainViewPager)findViewById(R.id.viewpager_main);
  mTabAdapter=new WPMainTabAdapter(getFragmentManager());
  mViewPager.setAdapter(mTabAdapter);
  mTabs=(SlidingTabLayout)findViewById(R.id.sliding_tabs);
  mTabs.setSelectedIndicatorColors(getResources().getColor(R.color.tab_indicator));
  mTabs.setDistributeEvenly(true);
  Integer icons[]={R.drawable.main_tab_sites,R.drawable.main_tab_reader,R.drawable.main_tab_me,R.drawable.main_tab_notifications};
  mTabs.setCustomTabView(R.layout.tab_icon,R.id.tab_icon,R.id.tab_badge,icons);
  mTabs.setViewPager(mViewPager);
  mTabs.setOnPageChangeListener(this);
  if (savedInstanceState == null) {
    if (showSignInIfRequired()) {
      int position=AppPrefs.getMainTabIndex();
      if (mTabAdapter.isValidPosition(position) && position != mViewPager.getCurrentItem()) {
        mViewPager.setCurrentItem(position);
      }
    }
  }
}
Program: 14397
Project: 14397
Buggy source:
private void initInfoButtons(View rootView){
  OnClickListener infoButtonListener=new OnClickListener(){
    @Override public void onClick(    View v){
      Intent intent=new Intent(getActivity(),HelpActivity.class);
      intent.putExtra(ENTERED_URL_KEY,EditTextUtils.getText(mUrlEditText));
      intent.putExtra(ENTERED_USERNAME_KEY,EditTextUtils.getText(mUsernameEditText));
      intent.putExtra(HelpshiftHelper.ORIGIN_KEY,Tag.ORIGIN_SETTINGS_SCREEN_HELP);
      startActivity(intent);
    }
  }
;
  mInfoButton=(ImageView)rootView.findViewById(R.id.info_button);
  mInfoButtonSecondary=(ImageView)rootView.findViewById(R.id.info_button_secondary);
  mInfoButton.setOnClickListener(infoButtonListener);
  mInfoButtonSecondary.setOnClickListener(infoButtonListener);
}

Fixed version (ground truth):
private void initInfoButtons(View rootView){
  OnClickListener infoButtonListener=new OnClickListener(){
    @Override public void onClick(    View v){
      Intent intent=new Intent(getActivity(),HelpActivity.class);
      intent.putExtra(ENTERED_URL_KEY,EditTextUtils.getText(mUrlEditText));
      intent.putExtra(ENTERED_USERNAME_KEY,EditTextUtils.getText(mUsernameEditText));
      intent.putExtra(HelpshiftHelper.ORIGIN_KEY,Tag.ORIGIN_LOGIN_SCREEN_HELP);
      startActivity(intent);
    }
  }
;
  mInfoButton=(ImageView)rootView.findViewById(R.id.info_button);
  mInfoButtonSecondary=(ImageView)rootView.findViewById(R.id.info_button_secondary);
  mInfoButton.setOnClickListener(infoButtonListener);
  mInfoButtonSecondary.setOnClickListener(infoButtonListener);
}
Program: 14400
Project: 14400
Buggy source:
/** 
 * Handles result from   {@link org.wordpress.android.ui.media.MediaPickerActivity}. Uploads local media to users blog then adds a gallery to the Post with all the selected media.
 * @param data
 */
private void handleGalleryResult(Intent data){
  if (data != null) {
    List<MediaItem> selectedContent=data.getParcelableArrayListExtra(MediaPickerActivity.SELECTED_CONTENT_RESULTS_KEY);
    if (selectedContent != null && selectedContent.size() > 0) {
      for (      MediaItem content : selectedContent) {
        Uri source=content.getSource();
        final String id=content.getTag();
        if (source != null && id != null) {
          final String sourceString=source.toString();
          if (sourceString.contains("String_Node_Str")) {
            mGalleryIds.add(id);
            AnalyticsTracker.track(Stat.EDITOR_ADDED_PHOTO_VIA_WP_MEDIA_LIBRARY);
          }
 else           if (MediaUtils.isValidImage(sourceString)) {
            queueFileForUpload(sourceString);
            addMedia(source,null,getActivity());
            AnalyticsTracker.track(Stat.EDITOR_ADDED_PHOTO_VIA_LOCAL_LIBRARY);
          }
        }
      }
      if (mUploadingMedia.size() > 0) {
        String galleryToast=getString(R.string.editor_toast_gallery_pending_formatted,mUploadingMedia.size());
        ToastUtils.showToast(getActivity(),galleryToast,ToastUtils.Duration.SHORT);
      }
 else {
        createGallery();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Handles result from   {@link org.wordpress.android.ui.media.MediaPickerActivity}. Uploads local media to users blog then adds a gallery to the Post with all the selected media.
 * @param data contains the selected media content with key {@link org.wordpress.android.ui.media.MediaPickerActivity#SELECTED_CONTENT_RESULTS_KEY}
 */
private void handleGalleryResult(Intent data){
  if (data != null) {
    List<MediaItem> selectedContent=data.getParcelableArrayListExtra(MediaPickerActivity.SELECTED_CONTENT_RESULTS_KEY);
    if (selectedContent != null && selectedContent.size() > 0) {
      mGalleryContentCount=selectedContent.size();
      for (      MediaItem content : selectedContent) {
        Uri source=content.getSource();
        final String id=content.getTag();
        if (source != null && id != null) {
          final String sourceString=source.toString();
          if (sourceString.contains("String_Node_Str")) {
            mGalleryIds.add(id);
            AnalyticsTracker.track(Stat.EDITOR_ADDED_PHOTO_VIA_WP_MEDIA_LIBRARY);
          }
 else           if (MediaUtils.isValidImage(sourceString)) {
            queueFileForUpload(sourceString);
            addMedia(source,null,getActivity());
            AnalyticsTracker.track(Stat.EDITOR_ADDED_PHOTO_VIA_LOCAL_LIBRARY);
          }
        }
      }
      if (mUploadingMedia.size() > 0) {
        String galleryToast=getString(R.string.editor_toast_gallery_pending_formatted,mUploadingMedia.size());
        ToastUtils.showToast(getActivity(),galleryToast,ToastUtils.Duration.SHORT);
      }
 else {
        createGallery();
      }
    }
  }
}
Program: 14401
Project: 14401
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
  if (MediaUploadService.MEDIA_UPLOAD_INTENT_NOTIFICATION.equals(action)) {
    String mediaId=intent.getStringExtra(MediaUploadService.MEDIA_UPLOAD_INTENT_NOTIFICATION_EXTRA);
    String newId=intent.getStringExtra(MediaUploadService.MEDIA_UPLOAD_INTENT_NOTIFICATION_ERROR);
    if (mediaId != null && newId != null && mUploadingMedia.contains(mediaId)) {
      mGalleryIds.add(newId);
      if (mGalleryIds.size() == mMediaIdToPath.size()) {
        for (        String id : mUploadingMedia) {
          String newText=mContentEditText.getText().toString().replace("String_Node_Str" + mMediaIdToPath.get(id) + "String_Node_Str","String_Node_Str");
          mContentEditText.setText(newText);
        }
        createGallery();
        stopMediaUploadService();
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  String action=intent.getAction();
  if (MediaUploadService.MEDIA_UPLOAD_INTENT_NOTIFICATION.equals(action)) {
    String mediaId=intent.getStringExtra(MediaUploadService.MEDIA_UPLOAD_INTENT_NOTIFICATION_EXTRA);
    String newId=intent.getStringExtra(MediaUploadService.MEDIA_UPLOAD_INTENT_NOTIFICATION_ERROR);
    if (mediaId != null && newId != null && mUploadingMedia.contains(mediaId)) {
      mGalleryIds.add(newId);
      if (mGalleryIds.size() == mGalleryContentCount) {
        for (        String id : mUploadingMedia) {
          String newText=mContentEditText.getText().toString().replace("String_Node_Str" + mMediaIdToPath.get(id) + "String_Node_Str","String_Node_Str");
          mContentEditText.setText(newText);
        }
        createGallery();
        stopMediaUploadService();
        mGalleryContentCount=0;
      }
    }
  }
}
Program: 14403
Project: 14403
Buggy source:
private Object uploadFileHelper(Object[] params,final File tempFile){
  AppLog.w(T.POSTS,"String_Node_Str" + params);
  if (mClient instanceof XMLRPCClient) {
    XMLRPCClient xmlrpcClient=(XMLRPCClient)mClient;
    xmlrpcClient.setOnBytesUploadedListener(new XMLRPCClient.OnBytesUploadedListener(){
      @Override public void onBytesUploaded(      long uploadedBytes){
        if (tempFile.length() == 0) {
          return;
        }
        float percentage=(uploadedBytes * 100) / tempFile.length();
        mPostUploadNotifier.updateNotificationProgress(percentage);
      }
    }
);
  }
  try {
    AppLog.i(T.API,"String_Node_Str" + params);
    return mClient.call("String_Node_Str",params,tempFile);
  }
 catch (  XMLRPCException e) {
    AppLog.e(T.API,e);
    mErrorMessage=mContext.getResources().getString(R.string.error_media_upload) + "String_Node_Str" + e.getMessage();
    return null;
  }
catch (  IOException e) {
    AppLog.e(T.API,e);
    mErrorMessage=mContext.getResources().getString(R.string.error_media_upload) + "String_Node_Str" + e.getMessage();
    return null;
  }
catch (  XmlPullParserException e) {
    AppLog.e(T.API,e);
    mErrorMessage=mContext.getResources().getString(R.string.error_media_upload) + "String_Node_Str" + e.getMessage();
    return null;
  }
 finally {
    if (tempFile != null && tempFile.exists()) {
      tempFile.delete();
    }
  }
}

Fixed version (ground truth):
private Object uploadFileHelper(Object[] params,final File tempFile){
  AppLog.d(T.POSTS,"String_Node_Str" + Arrays.toString(params));
  if (mClient instanceof XMLRPCClient) {
    XMLRPCClient xmlrpcClient=(XMLRPCClient)mClient;
    xmlrpcClient.setOnBytesUploadedListener(new XMLRPCClient.OnBytesUploadedListener(){
      @Override public void onBytesUploaded(      long uploadedBytes){
        if (tempFile.length() == 0) {
          return;
        }
        float percentage=(uploadedBytes * 100) / tempFile.length();
        mPostUploadNotifier.updateNotificationProgress(percentage);
      }
    }
);
  }
  try {
    return mClient.call("String_Node_Str",params,tempFile);
  }
 catch (  XMLRPCException e) {
    AppLog.e(T.API,e);
    mErrorMessage=mContext.getResources().getString(R.string.error_media_upload) + "String_Node_Str" + e.getMessage();
    return null;
  }
catch (  IOException e) {
    AppLog.e(T.API,e);
    mErrorMessage=mContext.getResources().getString(R.string.error_media_upload) + "String_Node_Str" + e.getMessage();
    return null;
  }
catch (  XmlPullParserException e) {
    AppLog.e(T.API,e);
    mErrorMessage=mContext.getResources().getString(R.string.error_media_upload) + "String_Node_Str" + e.getMessage();
    return null;
  }
 finally {
    if (tempFile != null && tempFile.exists()) {
      tempFile.delete();
    }
  }
}
Program: 14404
Project: 14404
Buggy source:
private String uploadImageFile(Map<String,Object> pictureParams,MediaFile mf,Blog blog){
  AppLog.d(T.POSTS,"String_Node_Str" + pictureParams);
  File tempFile;
  try {
    String fileExtension=MimeTypeMap.getFileExtensionFromUrl(mf.getFileName());
    tempFile=createTempUploadFile(fileExtension);
  }
 catch (  IOException e) {
    mIsMediaError=true;
    mErrorMessage=mContext.getString(R.string.file_not_found);
    return null;
  }
  Object[] params={1,blog.getUsername(),blog.getPassword(),pictureParams};
  Object result=uploadFileHelper(params,tempFile);
  if (result == null) {
    mIsMediaError=true;
    return null;
  }
  Map<?,?> contentHash=(HashMap<?,?>)result;
  String pictureURL=contentHash.get("String_Node_Str").toString();
  if (mf.isFeatured()) {
    try {
      if (contentHash.get("String_Node_Str") != null) {
        featuredImageID=Integer.parseInt(contentHash.get("String_Node_Str").toString());
        if (!mf.isFeaturedInPost())         return "String_Node_Str";
      }
    }
 catch (    NumberFormatException e) {
      AppLog.e(T.POSTS,e);
    }
  }
  return pictureURL;
}

Fixed version (ground truth):
private String uploadImageFile(Map<String,Object> pictureParams,MediaFile mf,Blog blog){
  File tempFile;
  try {
    String fileExtension=MimeTypeMap.getFileExtensionFromUrl(mf.getFileName());
    tempFile=createTempUploadFile(fileExtension);
  }
 catch (  IOException e) {
    mIsMediaError=true;
    mErrorMessage=mContext.getString(R.string.file_not_found);
    return null;
  }
  Object[] params={1,blog.getUsername(),blog.getPassword(),pictureParams};
  Object result=uploadFileHelper(params,tempFile);
  if (result == null) {
    mIsMediaError=true;
    return null;
  }
  Map<?,?> contentHash=(HashMap<?,?>)result;
  String pictureURL=contentHash.get("String_Node_Str").toString();
  if (mf.isFeatured()) {
    try {
      if (contentHash.get("String_Node_Str") != null) {
        featuredImageID=Integer.parseInt(contentHash.get("String_Node_Str").toString());
        if (!mf.isFeaturedInPost())         return "String_Node_Str";
      }
    }
 catch (    NumberFormatException e) {
      AppLog.e(T.POSTS,e);
    }
  }
  return pictureURL;
}
Program: 14405
Project: 14405
Buggy source:
private void toggleBlogFollowStatus(){
  if (!isAdded() || mFollowButton == null) {
    return;
  }
  final boolean isAskingToFollow=!ReaderBlogTable.isFollowedBlog(mCurrentBlogId);
  ReaderActions.ActionListener followListener=new ReaderActions.ActionListener(){
    @Override public void onActionResult(    boolean succeeded){
      if (!succeeded && isAdded()) {
        mFollowButton.setIsFollowed(!isAskingToFollow);
      }
    }
  }
;
  mFollowButton.setIsFollowedAnimated(isAskingToFollow);
  if (mCurrentFeedId != 0) {
    ReaderBlogActions.followFeedById(mCurrentFeedId,isAskingToFollow,followListener);
  }
 else {
    ReaderBlogActions.followBlogById(mCurrentBlogId,isAskingToFollow,followListener);
  }
}

Fixed version (ground truth):
private void toggleBlogFollowStatus(){
  if (!isAdded() || mFollowButton == null) {
    return;
  }
  final boolean isAskingToFollow;
  if (mCurrentFeedId != 0) {
    isAskingToFollow=!ReaderBlogTable.isFollowedFeed(mCurrentFeedId);
  }
 else {
    isAskingToFollow=!ReaderBlogTable.isFollowedBlog(mCurrentBlogId);
  }
  ReaderActions.ActionListener followListener=new ReaderActions.ActionListener(){
    @Override public void onActionResult(    boolean succeeded){
      if (!succeeded && isAdded()) {
        mFollowButton.setIsFollowed(!isAskingToFollow);
      }
    }
  }
;
  mFollowButton.setIsFollowedAnimated(isAskingToFollow);
  if (mCurrentFeedId != 0) {
    ReaderBlogActions.followFeedById(mCurrentFeedId,isAskingToFollow,followListener);
  }
 else {
    ReaderBlogActions.followBlogById(mCurrentBlogId,isAskingToFollow,followListener);
  }
}
Program: 14406
Project: 14406
Buggy source:
public void loadFeedInfo(long feedId,BlogInfoListener blogInfoListener){
  mBlogInfoListener=blogInfoListener;
  showBlogInfo(ReaderBlogTable.getBlogInfo(feedId),false);
  requestFeedInfo(feedId);
}

Fixed version (ground truth):
public void loadFeedInfo(long feedId,BlogInfoListener blogInfoListener){
  mBlogInfoListener=blogInfoListener;
  showBlogInfo(ReaderBlogTable.getFeedInfo(feedId),false);
  requestFeedInfo(feedId);
}
Program: 14407
Project: 14407
Buggy source:
public void setFeedUrl(String url){
  this.feedUrl=StringUtils.notNullStr(feedUrl);
}

Fixed version (ground truth):
public void setFeedUrl(String feedUrl){
  this.feedUrl=StringUtils.notNullStr(feedUrl);
}
Program: 14409
Project: 14409
Buggy source:
public static void d(T tag,String message){
  Log.d(TAG + "String_Node_Str" + tag.toString(),message);
  addEntry(tag,LogLevel.d,message);
}

Fixed version (ground truth):
public static void d(T tag,String message){
  message=StringUtils.notNullStr(message);
  Log.d(TAG + "String_Node_Str" + tag.toString(),message);
  addEntry(tag,LogLevel.d,message);
}
Program: 14410
Project: 14410
Buggy source:
public static void i(T tag,String message){
  Log.i(TAG + "String_Node_Str" + tag.toString(),message);
  addEntry(tag,LogLevel.i,message);
}

Fixed version (ground truth):
public static void i(T tag,String message){
  message=StringUtils.notNullStr(message);
  Log.i(TAG + "String_Node_Str" + tag.toString(),message);
  addEntry(tag,LogLevel.i,message);
}
Program: 14411
Project: 14411
Buggy source:
public static void v(T tag,String message){
  Log.v(TAG + "String_Node_Str" + tag.toString(),message);
  addEntry(tag,LogLevel.v,message);
}

Fixed version (ground truth):
public static void v(T tag,String message){
  message=StringUtils.notNullStr(message);
  Log.v(TAG + "String_Node_Str" + tag.toString(),message);
  addEntry(tag,LogLevel.v,message);
}
Program: 14412
Project: 14412
Buggy source:
public static void w(T tag,String message){
  Log.w(TAG + "String_Node_Str" + tag.toString(),message);
  addEntry(tag,LogLevel.w,message);
}

Fixed version (ground truth):
public static void w(T tag,String message){
  message=StringUtils.notNullStr(message);
  Log.w(TAG + "String_Node_Str" + tag.toString(),message);
  addEntry(tag,LogLevel.w,message);
}
Program: 14413
Project: 14413
Buggy source:
private boolean isValidPosition(int position){
  return (position > 0 && position < mComments.size());
}

Fixed version (ground truth):
private boolean isValidPosition(int position){
  return (position >= 0 && position < mComments.size());
}
Program: 14414
Project: 14414
Buggy source:
private void toggleLike(Context context,CommentHolder holder,ReaderComment comment,int position){
  if (!NetworkUtils.checkConnection(context)) {
    return;
  }
  boolean isAskingToLike=!comment.isLikedByCurrentUser;
  ReaderAnim.animateLikeButton(holder.imgLike,isAskingToLike);
  if (!ReaderCommentActions.performLikeAction(comment,isAskingToLike)) {
    ToastUtils.showToast(context,R.string.reader_toast_err_generic);
    return;
  }
  ReaderComment updatedComment=ReaderCommentTable.getComment(comment.blogId,comment.postId,comment.commentId);
  mComments.set(position,updatedComment);
  showLikeStatus(holder,updatedComment,position);
}

Fixed version (ground truth):
private void toggleLike(Context context,CommentHolder holder,int position){
  if (!NetworkUtils.checkConnection(context)) {
    return;
  }
  if (!isValidPosition(position)) {
    ToastUtils.showToast(context,R.string.reader_toast_err_generic);
    return;
  }
  ReaderComment comment=mComments.get(position);
  boolean isAskingToLike=!comment.isLikedByCurrentUser;
  ReaderAnim.animateLikeButton(holder.imgLike,isAskingToLike);
  if (!ReaderCommentActions.performLikeAction(comment,isAskingToLike)) {
    ToastUtils.showToast(context,R.string.reader_toast_err_generic);
    return;
  }
  ReaderComment updatedComment=ReaderCommentTable.getComment(comment.blogId,comment.postId,comment.commentId);
  mComments.set(position,updatedComment);
  showLikeStatus(holder,updatedComment,position);
}
Program: 14415
Project: 14415
Buggy source:
private void showLikeStatus(final CommentHolder holder,final ReaderComment comment,final int position){
  if (mPost.isLikesEnabled) {
    holder.layoutLikes.setVisibility(View.VISIBLE);
    holder.imgLike.setSelected(comment.isLikedByCurrentUser);
    if (comment.numLikes == 0) {
      holder.txtLike.setText(mLike);
      holder.txtLike.setTextColor(mLinkColor);
      holder.txtLikeCount.setVisibility(View.GONE);
    }
 else     if (comment.numLikes == 1 && comment.isLikedByCurrentUser) {
      holder.txtLike.setText(mLikedByYou);
      holder.txtLike.setTextColor(mLinkColor);
      holder.txtLikeCount.setVisibility(View.GONE);
    }
 else {
      holder.txtLike.setText(mLikedBy);
      holder.txtLike.setTextColor(mNoLinkColor);
      holder.txtLikeCount.setText(comment.numLikes == 1 ? mLikesSingle : String.format(mLikesMulti,comment.numLikes));
      holder.txtLikeCount.setSelected(comment.isLikedByCurrentUser);
      holder.txtLikeCount.setVisibility(View.VISIBLE);
    }
    holder.layoutLikes.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        toggleLike(v.getContext(),holder,comment,position);
      }
    }
);
    holder.txtLikeCount.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        ReaderActivityLauncher.showReaderLikingUsers(v.getContext(),comment);
      }
    }
);
  }
 else {
    holder.layoutLikes.setVisibility(View.GONE);
    holder.layoutLikes.setOnClickListener(null);
  }
}

Fixed version (ground truth):
private void showLikeStatus(final CommentHolder holder,final ReaderComment comment,final int position){
  if (mPost.isLikesEnabled) {
    holder.layoutLikes.setVisibility(View.VISIBLE);
    holder.imgLike.setSelected(comment.isLikedByCurrentUser);
    if (comment.numLikes == 0) {
      holder.txtLike.setText(mLike);
      holder.txtLike.setTextColor(mLinkColor);
      holder.txtLikeCount.setVisibility(View.GONE);
    }
 else     if (comment.numLikes == 1 && comment.isLikedByCurrentUser) {
      holder.txtLike.setText(mLikedByYou);
      holder.txtLike.setTextColor(mLinkColor);
      holder.txtLikeCount.setVisibility(View.GONE);
    }
 else {
      holder.txtLike.setText(mLikedBy);
      holder.txtLike.setTextColor(mNoLinkColor);
      holder.txtLikeCount.setText(comment.numLikes == 1 ? mLikesSingle : String.format(mLikesMulti,comment.numLikes));
      holder.txtLikeCount.setSelected(comment.isLikedByCurrentUser);
      holder.txtLikeCount.setVisibility(View.VISIBLE);
    }
    holder.layoutLikes.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        toggleLike(v.getContext(),holder,position);
      }
    }
);
    holder.txtLikeCount.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        ReaderActivityLauncher.showReaderLikingUsers(v.getContext(),comment);
      }
    }
);
  }
 else {
    holder.layoutLikes.setVisibility(View.GONE);
    holder.layoutLikes.setOnClickListener(null);
  }
}
Program: 14416
Project: 14416
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.stats_visitors_and_views_fragment,container,false);
  mDateTextView=(TextView)view.findViewById(R.id.stats_summary_date);
  mGraphContainer=(LinearLayout)view.findViewById(R.id.stats_bar_chart_fragment_container);
  mModuleButtonsContainer=(LinearLayout)view.findViewById(R.id.stats_pager_tabs);
  for (int i=0; i < overviewItems.length; i++) {
    LinearLayout currentTab=(LinearLayout)inflater.inflate(R.layout.stats_visitors_and_views_tab,container,false);
    boolean isLastItem=i == (overviewItems.length - 1);
    boolean isChecked=i == mSelectedOverviewItemIndex;
    TabViewHolder currentTabViewHolder=new TabViewHolder(currentTab,overviewItems[i],isChecked,isLastItem);
    currentTab.setOnClickListener(TopButtonsOnClickListener);
    currentTab.setTag(currentTabViewHolder);
    mModuleButtonsContainer.addView(currentTab);
  }
  mModuleButtonsContainer.setVisibility(View.VISIBLE);
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.stats_visitors_and_views_fragment,container,false);
  mDateTextView=(TextView)view.findViewById(R.id.stats_summary_date);
  mGraphContainer=(LinearLayout)view.findViewById(R.id.stats_bar_chart_fragment_container);
  mModuleButtonsContainer=(LinearLayout)view.findViewById(R.id.stats_pager_tabs);
  if (mModuleButtonsContainer.getChildCount() == overviewItems.length) {
    for (int i=0; i < mModuleButtonsContainer.getChildCount(); i++) {
      LinearLayout currentTab=(LinearLayout)mModuleButtonsContainer.getChildAt(i);
      boolean isLastItem=i == (overviewItems.length - 1);
      boolean isChecked=i == mSelectedOverviewItemIndex;
      TabViewHolder currentTabViewHolder=new TabViewHolder(currentTab,overviewItems[i],isChecked,isLastItem);
      currentTab.setOnClickListener(TopButtonsOnClickListener);
      currentTab.setTag(currentTabViewHolder);
    }
    mModuleButtonsContainer.setVisibility(View.VISIBLE);
  }
  return view;
}
Program: 14417
Project: 14417
Buggy source:
private void updateUIBelowTheGraph(int itemPosition){
  if (!isAdded()) {
    return;
  }
  if (mVisitsData == null) {
    setupNoResultsUI(false);
    return;
  }
  if (mVisitsData instanceof VolleyError) {
    setupNoResultsUI(false);
    return;
  }
  final VisitModel[] dataToShowOnGraph=getDataToShowOnGraph((VisitsModel)mVisitsData);
  if (dataToShowOnGraph.length <= itemPosition) {
    itemPosition=dataToShowOnGraph.length - 1;
  }
  String date=mStatsDate[itemPosition];
  if (date == null) {
    AppLog.w(AppLog.T.STATS,"String_Node_Str");
    return;
  }
  mDateTextView.setText(getDateForDisplayInLabels(date,getTimeframe()));
  VisitModel modelTapped=dataToShowOnGraph[itemPosition];
  for (int i=0; i < mModuleButtonsContainer.getChildCount(); i++) {
    View o=mModuleButtonsContainer.getChildAt(i);
    if (o instanceof LinearLayout && o.getTag() instanceof TabViewHolder) {
      TabViewHolder tabViewHolder=(TabViewHolder)o.getTag();
      tabViewHolder.updateBackGroundAndIcon();
switch (tabViewHolder.labelItem) {
case VIEWS:
        tabViewHolder.value.setText(FormatUtils.formatDecimal(modelTapped.getViews()));
      break;
case VISITORS:
    tabViewHolder.value.setText(FormatUtils.formatDecimal(modelTapped.getVisitors()));
  break;
case LIKES:
tabViewHolder.value.setText(FormatUtils.formatDecimal(modelTapped.getLikes()));
break;
case COMMENTS:
tabViewHolder.value.setText(FormatUtils.formatDecimal(modelTapped.getComments()));
break;
}
}
}
}

Fixed version (ground truth):
private void updateUIBelowTheGraph(int itemPosition){
  if (!isAdded()) {
    return;
  }
  if (mVisitsData == null) {
    setupNoResultsUI(false);
    return;
  }
  if (mVisitsData instanceof VolleyError) {
    setupNoResultsUI(false);
    return;
  }
  final VisitModel[] dataToShowOnGraph=getDataToShowOnGraph((VisitsModel)mVisitsData);
  if (dataToShowOnGraph.length == 0) {
    return;
  }
  if (dataToShowOnGraph.length <= itemPosition || itemPosition == -1) {
    itemPosition=dataToShowOnGraph.length - 1;
  }
  String date=mStatsDate[itemPosition];
  if (date == null) {
    AppLog.w(AppLog.T.STATS,"String_Node_Str");
    return;
  }
  mDateTextView.setText(getDateForDisplayInLabels(date,getTimeframe()));
  VisitModel modelTapped=dataToShowOnGraph[itemPosition];
  for (int i=0; i < mModuleButtonsContainer.getChildCount(); i++) {
    View o=mModuleButtonsContainer.getChildAt(i);
    if (o instanceof LinearLayout && o.getTag() instanceof TabViewHolder) {
      TabViewHolder tabViewHolder=(TabViewHolder)o.getTag();
      tabViewHolder.updateBackGroundAndIcon();
switch (tabViewHolder.labelItem) {
case VIEWS:
        tabViewHolder.value.setText(FormatUtils.formatDecimal(modelTapped.getViews()));
      break;
case VISITORS:
    tabViewHolder.value.setText(FormatUtils.formatDecimal(modelTapped.getVisitors()));
  break;
case LIKES:
tabViewHolder.value.setText(FormatUtils.formatDecimal(modelTapped.getLikes()));
break;
case COMMENTS:
tabViewHolder.value.setText(FormatUtils.formatDecimal(modelTapped.getComments()));
break;
}
}
}
}
Program: 14418
Project: 14418
Buggy source:
public String getLabel(){
  return WordPress.getContext().getString(mLabelResId);
}

Fixed version (ground truth):
public String getLabel(){
  return WordPress.getContext().getString(mLabelResId).toUpperCase();
}
Program: 14419
Project: 14419
Buggy source:
void updateCommentList(){
  CommentsListFragment listFragment=getListFragment();
  if (listFragment != null) {
    listFragment.updateComments(false);
    listFragment.setRefreshing(true);
  }
}

Fixed version (ground truth):
void updateCommentList(){
  CommentsListFragment listFragment=getListFragment();
  if (listFragment != null) {
    listFragment.setRefreshing(true);
    listFragment.updateComments(false);
  }
}
Program: 14420
Project: 14420
Buggy source:
void updateComments(boolean loadMore){
  if (mIsUpdatingComments) {
    AppLog.w(AppLog.T.COMMENTS,"String_Node_Str");
    return;
  }
  updateEmptyView(MessageType.LOADING);
  mUpdateCommentsTask=new UpdateCommentsTask(loadMore);
  mUpdateCommentsTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}

Fixed version (ground truth):
void updateComments(boolean loadMore){
  if (mIsUpdatingComments) {
    AppLog.w(AppLog.T.COMMENTS,"String_Node_Str");
    return;
  }
 else   if (!NetworkUtils.isNetworkAvailable(getActivity())) {
    updateEmptyView(MessageType.NETWORK_ERROR);
    setRefreshing(false);
    return;
  }
  updateEmptyView(MessageType.LOADING);
  mUpdateCommentsTask=new UpdateCommentsTask(loadMore);
  mUpdateCommentsTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Program: 14422
Project: 14422
Buggy source:
public void setFilter(Filter filter,MessageId messageId){
  mFilter=filter;
  Cursor cursor=filterItems(mFilter);
  if (filter != Filter.CUSTOM_DATE || cursor == null || cursor.getCount() == 0) {
    mResultView.setVisibility(View.GONE);
  }
  if (cursor != null && cursor.getCount() != 0) {
    mGridAdapter.swapCursor(cursor);
    hideEmptyView();
  }
 else {
    if (filter != Filter.CUSTOM_DATE) {
      showEmptyViewWithMessage(messageId);
    }
  }
}

Fixed version (ground truth):
public void setFilter(Filter filter,MessageId messageId){
  mFilter=filter;
  Cursor cursor=filterItems(mFilter);
  if (filter != Filter.CUSTOM_DATE || cursor == null || cursor.getCount() == 0) {
    mResultView.setVisibility(View.GONE);
  }
  if (cursor != null && cursor.getCount() != 0) {
    mGridAdapter.swapCursor(cursor);
    hideEmptyView();
  }
 else {
    mGridAdapter.changeCursor(null);
    if (filter != Filter.CUSTOM_DATE) {
      showEmptyViewWithMessage(messageId);
    }
  }
}
Program: 14423
Project: 14423
Buggy source:
private void hideEmptyView(){
  mEmptyView.setVisibility(View.GONE);
  mGridView.setVisibility(View.VISIBLE);
}

Fixed version (ground truth):
private void hideEmptyView(){
  mEmptyView.setVisibility(View.GONE);
}
Program: 14424
Project: 14424
Buggy source:
private void showEmptyViewWithMessage(MessageId messageId){
  int stringId=0;
switch (messageId) {
case LOADING:
    stringId=R.string.loading_media;
  break;
case NO_CONTENT:
stringId=R.string.media_empty_list;
break;
case NETWORK_ERROR:
stringId=R.string.network_error;
break;
case PERMISSION_ERROR:
stringId=R.string.media_error_no_permission;
break;
case NO_CONTENT_CUSTOM_DATE:
stringId=R.string.media_empty_list_custom_date;
break;
}
mGridView.setVisibility(View.GONE);
mEmptyView.setVisibility(View.VISIBLE);
mEmptyViewTitle.setText(getResources().getString(stringId));
}

Fixed version (ground truth):
private void showEmptyViewWithMessage(MessageId messageId){
  int stringId=0;
switch (messageId) {
case LOADING:
    stringId=R.string.loading_media;
  break;
case NO_CONTENT:
stringId=R.string.media_empty_list;
break;
case NETWORK_ERROR:
stringId=R.string.network_error;
break;
case PERMISSION_ERROR:
stringId=R.string.media_error_no_permission;
break;
case NO_CONTENT_CUSTOM_DATE:
stringId=R.string.media_empty_list_custom_date;
break;
}
mEmptyView.setVisibility(View.VISIBLE);
mEmptyViewTitle.setText(getResources().getString(stringId));
}
Program: 14426
Project: 14426
Buggy source:
private void updateEmptyView(MessageType messageType){
  if (mEmptyViewTitle != null) {
    int stringId=0;
    View noContentImage=getView().findViewById(R.id.empty_tags_box_top);
    if (messageType == MessageType.NO_CONTENT) {
      noContentImage.setVisibility(View.VISIBLE);
    }
 else {
      noContentImage.setVisibility(View.GONE);
    }
switch (messageType) {
case LOADING:
      stringId=mIsPage ? R.string.loading_pages : R.string.loading_posts;
    break;
case NO_CONTENT:
  stringId=mIsPage ? R.string.pages_empty_list : R.string.posts_empty_list;
break;
case NETWORK_ERROR:
stringId=R.string.network_error;
break;
case PERMISSION_ERROR:
stringId=mIsPage ? R.string.error_refresh_unauthorized_pages : R.string.error_refresh_unauthorized_posts;
break;
case GENERIC_ERROR:
stringId=mIsPage ? R.string.error_refresh_pages : R.string.error_refresh_posts;
break;
}
mEmptyViewTitle.setText(getText(stringId));
}
}

Fixed version (ground truth):
private void updateEmptyView(MessageType messageType){
  if (mEmptyView != null) {
    int stringId=0;
    if (messageType == MessageType.NO_CONTENT) {
      mEmptyViewImage.setVisibility(View.VISIBLE);
    }
 else {
      mEmptyViewImage.setVisibility(View.GONE);
    }
switch (messageType) {
case LOADING:
      stringId=mIsPage ? R.string.loading_pages : R.string.loading_posts;
    break;
case NO_CONTENT:
  stringId=mIsPage ? R.string.pages_empty_list : R.string.posts_empty_list;
break;
case NETWORK_ERROR:
stringId=R.string.network_error;
break;
case PERMISSION_ERROR:
stringId=mIsPage ? R.string.error_refresh_unauthorized_pages : R.string.error_refresh_unauthorized_posts;
break;
case GENERIC_ERROR:
stringId=mIsPage ? R.string.error_refresh_pages : R.string.error_refresh_posts;
break;
}
mEmptyViewTitle.setText(getText(stringId));
}
}
Program: 14427
Project: 14427
Buggy source:
@Override public void onPostsLoaded(int postCount){
  if (!isAdded()) {
    return;
  }
  if (getListView().getEmptyView() == null) {
    getListView().setEmptyView(getView().findViewById(R.id.empty_view));
  }
  if (postCount == 0 && !isRefreshing()) {
    updateEmptyView(MessageType.NO_CONTENT);
  }
  if (postCount == 0 && mCanLoadMorePosts) {
    if (isAdded() && NetworkUtils.isNetworkAvailable(getActivity())) {
      setRefreshing(true);
      requestPosts(false);
    }
 else {
      updateEmptyView(MessageType.NETWORK_ERROR);
    }
  }
 else   if (mShouldSelectFirstPost) {
    mShouldSelectFirstPost=false;
    if (mPostsListAdapter.getCount() > 0) {
      PostsListPost postsListPost=(PostsListPost)mPostsListAdapter.getItem(0);
      if (postsListPost != null) {
        showPost(postsListPost.getPostId());
        getListView().setItemChecked(0,true);
      }
    }
  }
 else   if (isAdded() && ((PostsActivity)getActivity()).isDualPane()) {
    int selectedPosition=getListView().getCheckedItemPosition();
    if (selectedPosition != ListView.INVALID_POSITION && selectedPosition < mPostsListAdapter.getCount()) {
      PostsListPost postsListPost=(PostsListPost)mPostsListAdapter.getItem(selectedPosition);
      if (postsListPost != null) {
        showPost(postsListPost.getPostId());
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onPostsLoaded(int postCount){
  if (!isAdded()) {
    return;
  }
  if (postCount == 0) {
    mEmptyView.setVisibility(View.VISIBLE);
  }
 else {
    mEmptyView.setVisibility(View.GONE);
  }
  if (!isRefreshing()) {
    updateEmptyView(MessageType.NO_CONTENT);
  }
  if (postCount == 0 && mCanLoadMorePosts) {
    if (isAdded() && NetworkUtils.isNetworkAvailable(getActivity())) {
      setRefreshing(true);
      requestPosts(false);
    }
 else {
      updateEmptyView(MessageType.NETWORK_ERROR);
    }
  }
 else   if (mShouldSelectFirstPost) {
    mShouldSelectFirstPost=false;
    if (mPostsListAdapter.getCount() > 0) {
      PostsListPost postsListPost=(PostsListPost)mPostsListAdapter.getItem(0);
      if (postsListPost != null) {
        showPost(postsListPost.getPostId());
        getListView().setItemChecked(0,true);
      }
    }
  }
 else   if (isAdded() && ((PostsActivity)getActivity()).isDualPane()) {
    int selectedPosition=getListView().getCheckedItemPosition();
    if (selectedPosition != ListView.INVALID_POSITION && selectedPosition < mPostsListAdapter.getCount()) {
      PostsListPost postsListPost=(PostsListPost)mPostsListAdapter.getItem(selectedPosition);
      if (postsListPost != null) {
        showPost(postsListPost.getPostId());
      }
    }
  }
}
Program: 14428
Project: 14428
Buggy source:
@Override public View onCreateView(@NonNull LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.post_listview,container,false);
  mEmptyViewTitle=(TextView)view.findViewById(R.id.title_empty);
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(@NonNull LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.post_listview,container,false);
  mEmptyView=view.findViewById(R.id.empty_view);
  mEmptyViewImage=view.findViewById(R.id.empty_tags_box_top);
  mEmptyViewTitle=(TextView)view.findViewById(R.id.title_empty);
  return view;
}
Program: 14429
Project: 14429
Buggy source:
@Override public void onClick(View v){
  showSettings();
}

Fixed version (ground truth):
@Override public void onClick(View v){
  if (isFinishing())   return;
  FragmentManager fm=getFragmentManager();
  if (fm.getBackStackEntryCount() > 0) {
    fm.popBackStack();
  }
 else {
    toggleDrawer();
  }
}
Program: 14431
Project: 14431
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(null);
  createMenuDrawer(R.layout.comment_activity);
  setSupportActionBar(getToolbar());
  ActionBar actionBar=getSupportActionBar();
  if (actionBar != null) {
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(getString(R.string.tab_comments));
  }
  getFragmentManager().addOnBackStackChangedListener(mOnBackStackChangedListener);
  restoreSavedInstance(savedInstanceState);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(null);
  createMenuDrawer(R.layout.comment_activity);
  ActionBar actionBar=getSupportActionBar();
  if (actionBar != null) {
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(getString(R.string.tab_comments));
  }
  getFragmentManager().addOnBackStackChangedListener(mOnBackStackChangedListener);
  restoreSavedInstance(savedInstanceState);
}
Program: 14433
Project: 14433
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  createMenuDrawer(R.layout.media_browser_activity);
  setSupportActionBar(getToolbar());
  ActionBar actionBar=getSupportActionBar();
  if (actionBar != null) {
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(R.string.media);
  }
  FragmentManager fm=getFragmentManager();
  fm.addOnBackStackChangedListener(mOnBackStackChangedListener);
  FragmentTransaction ft=fm.beginTransaction();
  setupBaseLayout();
  mMediaAddFragment=(MediaAddFragment)fm.findFragmentById(R.id.mediaAddFragment);
  mMediaGridFragment=(MediaGridFragment)fm.findFragmentById(R.id.mediaGridFragment);
  mMediaItemFragment=(MediaItemFragment)fm.findFragmentByTag(MediaItemFragment.TAG);
  if (mMediaItemFragment != null)   ft.hide(mMediaGridFragment);
  mMediaEditFragment=(MediaEditFragment)fm.findFragmentByTag(MediaEditFragment.TAG);
  if (mMediaEditFragment != null && !mMediaEditFragment.isInLayout())   ft.hide(mMediaItemFragment);
  ft.commit();
  setupAddMenuPopup();
  String action=getIntent().getAction();
  if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_SEND_MULTIPLE.equals(action)) {
    uploadSharedFiles();
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  createMenuDrawer(R.layout.media_browser_activity);
  ActionBar actionBar=getSupportActionBar();
  if (actionBar != null) {
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(R.string.media);
  }
  FragmentManager fm=getFragmentManager();
  fm.addOnBackStackChangedListener(mOnBackStackChangedListener);
  FragmentTransaction ft=fm.beginTransaction();
  setupBaseLayout();
  mMediaAddFragment=(MediaAddFragment)fm.findFragmentById(R.id.mediaAddFragment);
  mMediaGridFragment=(MediaGridFragment)fm.findFragmentById(R.id.mediaGridFragment);
  mMediaItemFragment=(MediaItemFragment)fm.findFragmentByTag(MediaItemFragment.TAG);
  if (mMediaItemFragment != null)   ft.hide(mMediaGridFragment);
  mMediaEditFragment=(MediaEditFragment)fm.findFragmentByTag(MediaEditFragment.TAG);
  if (mMediaEditFragment != null && !mMediaEditFragment.isInLayout())   ft.hide(mMediaItemFragment);
  ft.commit();
  setupAddMenuPopup();
  String action=getIntent().getAction();
  if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_SEND_MULTIPLE.equals(action)) {
    uploadSharedFiles();
  }
}
Program: 14435
Project: 14435
Buggy source:
public void onBackStackChanged(){
  int backStackEntryCount=getFragmentManager().getBackStackEntryCount();
  if (getSupportActionBar() != null && backStackEntryCount == 0) {
    getSupportActionBar().setTitle(R.string.notifications);
  }
  if (getDrawerToggle() != null) {
    getDrawerToggle().setDrawerIndicatorEnabled(backStackEntryCount == 0);
  }
}

Fixed version (ground truth):
public void onBackStackChanged(){
  int backStackEntryCount=getFragmentManager().getBackStackEntryCount();
  if (getSupportActionBar() != null && backStackEntryCount == 0) {
    getSupportActionBar().setTitle(R.string.notifications);
  }
 else {
    mRestoredReplyText=getCommentReplyText();
  }
  if (getDrawerToggle() != null) {
    getDrawerToggle().setDrawerIndicatorEnabled(backStackEntryCount == 0);
  }
}