nus-yam/ex-repair huggingface dataset:
Program: 13827
Project: 13827
Buggy source:
private void cancelUpload(MediaModel oneUpload){
  if (oneUpload != null) {
    SiteModel site=mSiteStore.getSiteByLocalId(oneUpload.getLocalSiteId());
    if (site != null) {
      dispatchCancelAction(oneUpload,site);
    }
 else {
      AppLog.i(T.MEDIA,"String_Node_Str" + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
private void cancelUpload(MediaModel oneUpload,boolean delete){
  if (oneUpload != null) {
    SiteModel site=mSiteStore.getSiteByLocalId(oneUpload.getLocalSiteId());
    if (site != null) {
      dispatchCancelAction(oneUpload,site,delete);
    }
 else {
      AppLog.i(T.MEDIA,"String_Node_Str" + "String_Node_Str");
    }
  }
}
Program: 13828
Project: 13828
Buggy source:
@Override public void onMediaUploadCancelClicked(String localMediaId,boolean delete){
  if (!TextUtils.isEmpty(localMediaId)) {
    MediaModel mediaModel=mMediaStore.getMediaWithLocalId(Integer.valueOf(localMediaId));
    if (mediaModel != null) {
      CancelMediaPayload payload=new CancelMediaPayload(mSite,mediaModel,delete);
      mDispatcher.dispatch(MediaActionBuilder.newCancelMediaUploadAction(payload));
    }
  }
 else {
    ToastUtils.showToast(this,getString(R.string.error_all_media_upload_canceled));
    EventBus.getDefault().post(new PostEvents.PostMediaCanceled(mPost));
  }
}

Fixed version (ground truth):
@Override public void onMediaUploadCancelClicked(String localMediaId){
  if (!TextUtils.isEmpty(localMediaId)) {
    MediaModel mediaModel=mMediaStore.getMediaWithLocalId(Integer.valueOf(localMediaId));
    if (mediaModel != null) {
      CancelMediaPayload payload=new CancelMediaPayload(mSite,mediaModel);
      mDispatcher.dispatch(MediaActionBuilder.newCancelMediaUploadAction(payload));
    }
  }
 else {
    ToastUtils.showToast(this,getString(R.string.error_all_media_upload_canceled));
    EventBus.getDefault().post(new PostEvents.PostMediaCanceled(mPost));
  }
}
Program: 13829
Project: 13829
Buggy source:
@Override public void onMediaUploadCancelClicked(String mediaId,boolean delete){
}

Fixed version (ground truth):
@Override public void onMediaUploadCancelClicked(String mediaId){
}
Program: 13832
Project: 13832
Buggy source:
@Override public void onMediaRemoved(String mediaId){
  mUploadingMedia.remove(mediaId);
  mFailedMediaIds.remove(mediaId);
  mEditorFragmentListener.onMediaUploadCancelClicked(mediaId,true);
}

Fixed version (ground truth):
@Override public void onMediaRemoved(String mediaId){
  mUploadingMedia.remove(mediaId);
  mFailedMediaIds.remove(mediaId);
  mEditorFragmentListener.onMediaUploadCancelClicked(mediaId);
}
Program: 13833
Project: 13833
Buggy source:
void onMediaUploadCancelClicked(String mediaId,boolean delete);

Fixed version (ground truth):
void onMediaUploadCancelClicked(String mediaId);
Program: 13834
Project: 13834
Buggy source:
@Override public void onMediaUploadCancelClicked(String mediaId,boolean delete){
}

Fixed version (ground truth):
@Override public void onMediaUploadCancelClicked(String mediaId){
}
Program: 13836
Project: 13836
Buggy source:
@Override public void onPostButtonClicked(int buttonType,PostModel post){
  if (!isAdded())   return;
  post=mPostStore.getPostByLocalPostId(post.getId());
  if (post == null) {
    loadPosts(LoadMode.FORCED);
    return;
  }
switch (buttonType) {
case PostListButton.BUTTON_EDIT:
    ActivityLauncher.editPostOrPageForResult(getActivity(),mSite,post);
  break;
case PostListButton.BUTTON_SUBMIT:
case PostListButton.BUTTON_SYNC:
case PostListButton.BUTTON_PUBLISH:
publishPost(post);
break;
case PostListButton.BUTTON_VIEW:
ActivityLauncher.browsePostOrPage(getActivity(),mSite,post);
break;
case PostListButton.BUTTON_PREVIEW:
ActivityLauncher.viewPostPreviewForResult(getActivity(),mSite,post,mIsPage);
break;
case PostListButton.BUTTON_STATS:
ActivityLauncher.viewStatsSinglePostDetails(getActivity(),mSite,post,mIsPage);
break;
case PostListButton.BUTTON_TRASH:
case PostListButton.BUTTON_DELETE:
if (!PostUploadService.isPostUploading(post)) {
trashPost(post);
}
break;
}
}

Fixed version (ground truth):
@Override public void onPostButtonClicked(int buttonType,PostModel post){
  if (!isAdded())   return;
  post=mPostStore.getPostByLocalPostId(post.getId());
  if (post == null) {
    loadPosts(LoadMode.FORCED);
    return;
  }
switch (buttonType) {
case PostListButton.BUTTON_EDIT:
    if (PostUploadService.isPostUploadingOrQueued(post)) {
      PostUploadService.cancelQueuedPostUpload(post);
    }
  ActivityLauncher.editPostOrPageForResult(getActivity(),mSite,post);
break;
case PostListButton.BUTTON_SUBMIT:
case PostListButton.BUTTON_SYNC:
case PostListButton.BUTTON_PUBLISH:
publishPost(post);
break;
case PostListButton.BUTTON_VIEW:
ActivityLauncher.browsePostOrPage(getActivity(),mSite,post);
break;
case PostListButton.BUTTON_PREVIEW:
ActivityLauncher.viewPostPreviewForResult(getActivity(),mSite,post,mIsPage);
break;
case PostListButton.BUTTON_STATS:
ActivityLauncher.viewStatsSinglePostDetails(getActivity(),mSite,post,mIsPage);
break;
case PostListButton.BUTTON_TRASH:
case PostListButton.BUTTON_DELETE:
if (!PostUploadService.isPostUploadingOrQueued(post)) {
trashPost(post);
}
break;
}
}
Program: 13837
Project: 13837
Buggy source:
@Override protected Boolean doInBackground(Void... nada){
  if (mIsPage) {
    tmpPosts=mPostStore.getPagesForSite(mSite);
  }
 else {
    tmpPosts=mPostStore.getPostsForSite(mSite);
  }
  for (  PostModel hiddenPost : mHiddenPosts) {
    tmpPosts.remove(hiddenPost);
  }
  if (mLoadMode == LoadMode.IF_CHANGED && PostUtils.postListsAreEqual(mPosts,tmpPosts)) {
    boolean postsAreUploading=false;
    for (    PostModel post : tmpPosts) {
      if (PostUploadService.isPostUploading(post)) {
        postsAreUploading=true;
        break;
      }
    }
    if (!postsAreUploading) {
      return false;
    }
  }
  String imageUrl=null;
  mFeaturedImageUrls.clear();
  for (  PostModel post : tmpPosts) {
    if (post.isLocalDraft()) {
      imageUrl=null;
    }
 else     if (post.getFeaturedImageId() != 0) {
      MediaModel media=mMediaStore.getSiteMediaWithId(mSite,post.getFeaturedImageId());
      if (media != null) {
        imageUrl=media.getUrl();
      }
 else {
        imageUrl=null;
      }
      if (TextUtils.isEmpty(imageUrl)) {
        mediaIdsToUpdate.add(post.getFeaturedImageId());
      }
    }
 else     if (StringUtils.isNotEmpty(post.getContent())) {
      ReaderImageScanner scanner=new ReaderImageScanner(post.getContent(),mSite.isPrivate());
      imageUrl=scanner.getLargestImage();
    }
 else {
      imageUrl=null;
    }
    if (!TextUtils.isEmpty(imageUrl)) {
      mFeaturedImageUrls.put(post.getId(),ReaderUtils.getResizedImageUrl(imageUrl,mPhotonWidth,mPhotonHeight,mSite.isPrivate()));
    }
  }
  return true;
}

Fixed version (ground truth):
@Override protected Boolean doInBackground(Void... nada){
  if (mIsPage) {
    tmpPosts=mPostStore.getPagesForSite(mSite);
  }
 else {
    tmpPosts=mPostStore.getPostsForSite(mSite);
  }
  for (  PostModel hiddenPost : mHiddenPosts) {
    tmpPosts.remove(hiddenPost);
  }
  if (mLoadMode == LoadMode.IF_CHANGED && PostUtils.postListsAreEqual(mPosts,tmpPosts)) {
    boolean postsAreUploading=false;
    for (    PostModel post : tmpPosts) {
      if (PostUploadService.isPostUploadingOrQueued(post)) {
        postsAreUploading=true;
        break;
      }
    }
    if (!postsAreUploading) {
      return false;
    }
  }
  String imageUrl=null;
  mFeaturedImageUrls.clear();
  for (  PostModel post : tmpPosts) {
    if (post.isLocalDraft()) {
      imageUrl=null;
    }
 else     if (post.getFeaturedImageId() != 0) {
      MediaModel media=mMediaStore.getSiteMediaWithId(mSite,post.getFeaturedImageId());
      if (media != null) {
        imageUrl=media.getUrl();
      }
 else {
        imageUrl=null;
      }
      if (TextUtils.isEmpty(imageUrl)) {
        mediaIdsToUpdate.add(post.getFeaturedImageId());
      }
    }
 else     if (StringUtils.isNotEmpty(post.getContent())) {
      ReaderImageScanner scanner=new ReaderImageScanner(post.getContent(),mSite.isPrivate());
      imageUrl=scanner.getLargestImage();
    }
 else {
      imageUrl=null;
    }
    if (!TextUtils.isEmpty(imageUrl)) {
      mFeaturedImageUrls.put(post.getId(),ReaderUtils.getResizedImageUrl(imageUrl,mPhotonWidth,mPhotonHeight,mSite.isPrivate()));
    }
  }
  return true;
}
Program: 13838
Project: 13838
Buggy source:
private boolean canPublishPost(PostModel post){
  return post != null && !PostUploadService.isPostUploading(post) && (post.isLocallyChanged() || post.isLocalDraft() || PostStatus.fromPost(post) == PostStatus.DRAFT);
}

Fixed version (ground truth):
private boolean canPublishPost(PostModel post){
  return post != null && !PostUploadService.isPostUploadingOrQueued(post) && (post.isLocallyChanged() || post.isLocalDraft() || PostStatus.fromPost(post) == PostStatus.DRAFT);
}
Program: 13840
Project: 13840
Buggy source:
/** 
 * Removes a post from the queued post list given its local ID.
 * @return the post that was removed - if no post was removed, returns null
 */
private PostModel removeQueuedPostByLocalId(int localPostId){
synchronized (mPostsList) {
    Iterator<PostModel> iterator=mPostsList.iterator();
    while (iterator.hasNext()) {
      PostModel postModel=iterator.next();
      if (postModel.getId() == localPostId) {
        iterator.remove();
        return postModel;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Removes a post from the queued post list given its local ID.
 * @return the post that was removed - if no post was removed, returns null
 */
private PostModel removeQueuedPostByLocalId(int localPostId){
synchronized (mQueuedPostsList) {
    Iterator<PostModel> iterator=mQueuedPostsList.iterator();
    while (iterator.hasNext()) {
      PostModel postModel=iterator.next();
      if (postModel.getId() == localPostId) {
        iterator.remove();
        return postModel;
      }
    }
  }
  return null;
}
Program: 13841
Project: 13841
Buggy source:
private void uploadNextPost(){
synchronized (mPostsList) {
    if (mCurrentTask == null) {
      mCurrentUploadingPost=null;
      mCurrentUploadingPostAnalyticsProperties=null;
      if (mPostsList.size() > 0) {
        if (!mUseLegacyMode) {
          PostModel nextPost=getNextUploadablePost();
          if (nextPost != null) {
            mCurrentUploadingPost=nextPost;
            mCurrentTask=new UploadPostTask();
            mCurrentTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR,mCurrentUploadingPost);
          }
        }
 else {
          mCurrentUploadingPost=mPostsList.remove(0);
          mCurrentTask=new UploadPostTask();
          mCurrentTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR,mCurrentUploadingPost);
        }
      }
 else {
        stopSelf();
      }
    }
  }
}

Fixed version (ground truth):
private void uploadNextPost(){
synchronized (mQueuedPostsList) {
    if (mCurrentTask == null) {
      mCurrentUploadingPost=null;
      mCurrentUploadingPostAnalyticsProperties=null;
      if (mQueuedPostsList.size() > 0) {
        if (!mUseLegacyMode) {
          PostModel nextPost=getNextUploadablePost();
          if (nextPost != null) {
            mCurrentUploadingPost=nextPost;
            mCurrentTask=new UploadPostTask();
            mCurrentTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR,mCurrentUploadingPost);
          }
        }
 else {
          mCurrentUploadingPost=mQueuedPostsList.remove(0);
          mCurrentTask=new UploadPostTask();
          mCurrentTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR,mCurrentUploadingPost);
        }
      }
 else {
        stopSelf();
      }
    }
  }
}
Program: 13842
Project: 13842
Buggy source:
private PostModel getNextUploadablePost(){
  Iterator<PostModel> iterator=mPostsList.iterator();
  while (iterator.hasNext()) {
    PostModel postModel=iterator.next();
    if (!MediaUploadService.hasPendingMediaUploadsForPost(postModel)) {
      PostModel latestPost=mPostStore.getPostByLocalPostId(postModel.getId());
      iterator.remove();
      return latestPost;
    }
  }
  AppLog.d(T.POSTS,"String_Node_Str");
  return null;
}

Fixed version (ground truth):
private PostModel getNextUploadablePost(){
  Iterator<PostModel> iterator=mQueuedPostsList.iterator();
  while (iterator.hasNext()) {
    PostModel postModel=iterator.next();
    if (!MediaUploadService.hasPendingMediaUploadsForPost(postModel)) {
      PostModel latestPost=mPostStore.getPostByLocalPostId(postModel.getId());
      iterator.remove();
      return latestPost;
    }
  }
  AppLog.d(T.POSTS,"String_Node_Str");
  return null;
}
Program: 13843
Project: 13843
Buggy source:
/** 
 * Adds a post to the queue.
 */
public static void addPostToUpload(PostModel post){
synchronized (mPostsList) {
    mPostsList.add(post);
  }
}

Fixed version (ground truth):
/** 
 * Adds a post to the queue.
 */
public static void addPostToUpload(PostModel post){
synchronized (mQueuedPostsList) {
    mQueuedPostsList.add(post);
  }
}
Program: 13844
Project: 13844
Buggy source:
private void showNotificationsForPendingMediaPosts(){
  for (  PostModel postModel : mPostsList) {
    if (MediaUploadService.hasPendingMediaUploadsForPost(postModel)) {
      if (!mPostUploadNotifier.isDisplayingNotificationForPost(postModel)) {
        mPostUploadNotifier.createNotificationForPost(postModel,getString(R.string.uploading_post_media));
      }
    }
  }
}

Fixed version (ground truth):
private void showNotificationsForPendingMediaPosts(){
  for (  PostModel postModel : mQueuedPostsList) {
    if (MediaUploadService.hasPendingMediaUploadsForPost(postModel)) {
      if (!mPostUploadNotifier.isDisplayingNotificationForPost(postModel)) {
        mPostUploadNotifier.createNotificationForPost(postModel,getString(R.string.uploading_post_media));
      }
    }
  }
}
Program: 13845
Project: 13845
Buggy source:
/** 
 * Returns true if the passed post is either uploading or waiting to be uploaded.
 */
public static boolean isPostUploading(PostModel post){
  if (mCurrentUploadingPost != null && mCurrentUploadingPost.getId() == post.getId()) {
    return true;
  }
  if (mPostsList.size() > 0) {
synchronized (mPostsList) {
      for (      PostModel queuedPost : mPostsList) {
        if (queuedPost.getId() == post.getId()) {
          return true;
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Returns true if the passed post is currently uploading. Except for legacy mode, a post counts as 'uploading' if the post content itself is being uploaded - a post waiting for media to finish uploading counts as 'waiting to be uploaded' until the media uploads complete.
 */
public static boolean isPostUploading(PostModel post){
  return mCurrentUploadingPost != null && mCurrentUploadingPost.getId() == post.getId();
}
Program: 13846
Project: 13846
Buggy source:
@Override public int onStartCommand(Intent intent,int flags,int startId){
synchronized (mPostsList) {
    if (mPostsList.size() == 0 || mContext == null) {
      stopSelf();
      return START_NOT_STICKY;
    }
  }
  uploadNextPost();
  showNotificationsForPendingMediaPosts();
  return START_STICKY;
}

Fixed version (ground truth):
@Override public int onStartCommand(Intent intent,int flags,int startId){
synchronized (mQueuedPostsList) {
    if (mQueuedPostsList.size() == 0 || mContext == null) {
      stopSelf();
      return START_NOT_STICKY;
    }
  }
  uploadNextPost();
  showNotificationsForPendingMediaPosts();
  return START_STICKY;
}
Program: 13847
Project: 13847
Buggy source:
private void finishUpload(){
synchronized (mPostsList) {
    mCurrentTask=null;
    mCurrentUploadingPost=null;
    mCurrentUploadingPostAnalyticsProperties=null;
  }
  uploadNextPost();
}

Fixed version (ground truth):
private void finishUpload(){
synchronized (mQueuedPostsList) {
    mCurrentTask=null;
    mCurrentUploadingPost=null;
    mCurrentUploadingPostAnalyticsProperties=null;
  }
  uploadNextPost();
}
Program: 13848
Project: 13848
Buggy source:
public WPPrefView(Context context,AttributeSet attrs,int defStyleAttr,int defStyleRes){
  super(context,attrs,defStyleAttr,defStyleRes);
  initView(context,attrs);
}

Fixed version (ground truth):
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public WPPrefView(Context context,AttributeSet attrs,int defStyleAttr,int defStyleRes){
  super(context,attrs,defStyleAttr,defStyleRes);
  initView(context,attrs);
}
Program: 13849
Project: 13849
Buggy source:
@SuppressWarnings("String_Node_Str") @Subscribe(threadMode=ThreadMode.MAIN) public void onAuthenticationChanged(OnAuthenticationChanged event){
  if (event.isError() && mSelectedSite != null) {
    AuthenticationDialogUtils.showAuthErrorView(this,mSelectedSite);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Subscribe(threadMode=ThreadMode.MAIN) public void onAuthenticationChanged(OnAuthenticationChanged event){
  if (event.isError() && mSelectedSite != null && event.error.type == AuthenticationErrorType.INVALID_TOKEN) {
    AuthenticationDialogUtils.showAuthErrorView(this,mSelectedSite);
  }
}
Program: 13850
Project: 13850
Buggy source:
private void handleSiteRemoved(){
  if (!FluxCUtils.isSignedInWPComOrHasWPOrgSite(mAccountStore,mSiteStore)) {
    resetFragments();
    ActivityLauncher.showSignInForResult(this);
  }
 else {
    SiteModel site=getSelectedSite();
    if (site != null) {
      ActivityLauncher.showSitePickerForResult(this,site);
    }
  }
}

Fixed version (ground truth):
private void handleSiteRemoved(){
  if (!FluxCUtils.isSignedInWPComOrHasWPOrgSite(mAccountStore,mSiteStore)) {
    resetFragments();
    setSelectedSite(null);
    ActivityLauncher.showSignInForResult(this);
  }
 else {
    SiteModel site=getSelectedSite();
    if (site != null) {
      ActivityLauncher.showSitePickerForResult(this,site);
    }
  }
}
Program: 13851
Project: 13851
Buggy source:
private void showStatsActivityForSite(@NonNull SiteModel site,NoteBlockRangeType rangeType){
  if (isFinishing())   return;
  if (rangeType == NoteBlockRangeType.FOLLOW) {
    Intent intent=new Intent(this,StatsViewAllActivity.class);
    intent.putExtra(StatsAbstractFragment.ARGS_VIEW_TYPE,StatsViewType.FOLLOWERS);
    intent.putExtra(StatsAbstractFragment.ARGS_TIMEFRAME,StatsTimeframe.DAY);
    intent.putExtra(StatsAbstractFragment.ARGS_SELECTED_DATE,"String_Node_Str");
    intent.putExtra(WordPress.SITE,site);
    intent.putExtra(StatsViewAllActivity.ARG_STATS_VIEW_ALL_TITLE,getString(R.string.stats_view_followers));
    startActivity(intent);
  }
 else {
    ActivityLauncher.viewBlogStats(this,site);
  }
}

Fixed version (ground truth):
private void showStatsActivityForSite(@NonNull SiteModel site,NoteBlockRangeType rangeType){
  if (isFinishing())   return;
  if (rangeType == NoteBlockRangeType.FOLLOW) {
    Intent intent=new Intent(this,StatsViewAllActivity.class);
    intent.putExtra(StatsAbstractFragment.ARGS_VIEW_TYPE,StatsViewType.FOLLOWERS);
    intent.putExtra(StatsAbstractFragment.ARGS_TIMEFRAME,StatsTimeframe.DAY);
    intent.putExtra(StatsAbstractFragment.ARGS_SELECTED_DATE,"String_Node_Str");
    intent.putExtra(StatsAbstractFragment.ARGS_IS_SINGLE_VIEW,true);
    intent.putExtra(StatsActivity.ARG_LOCAL_TABLE_SITE_ID,site.getId());
    intent.putExtra(StatsViewAllActivity.ARG_STATS_VIEW_ALL_TITLE,getString(R.string.stats_view_followers));
    startActivity(intent);
  }
 else {
    ActivityLauncher.viewBlogStats(this,site);
  }
}
Program: 13853
Project: 13853
Buggy source:
@SuppressWarnings("String_Node_Str") @Subscribe(threadMode=ThreadMode.MAIN) public void onTaxonomyChanged(TaxonomyStore.OnTaxonomyChanged event){
switch (event.causeOfChange) {
case FETCH_TAGS:
    mAdapter.setAllTags(mTaxonomyStore.getTagsForPost(mPost,mSite));
  filterListForCurrentText();
break;
}
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Subscribe(threadMode=ThreadMode.MAIN) public void onTaxonomyChanged(TaxonomyStore.OnTaxonomyChanged event){
switch (event.causeOfChange) {
case FETCH_TAGS:
    mAdapter.setAllTags(mTaxonomyStore.getTagsForSite(mSite));
  filterListForCurrentText();
break;
}
}
Program: 13854
Project: 13854
Buggy source:
private void filterListForCurrentText(){
  String text=mTagsEditText.getText().toString();
  if (!TextUtils.isEmpty(text)) {
    int endIndex=text.lastIndexOf("String_Node_Str");
    if (endIndex == -1) {
      mAdapter.filter(text);
    }
 else     if (endIndex + 1 <= text.length()) {
      String textToFilter=text.substring(endIndex + 1);
      mAdapter.filter(textToFilter);
    }
  }
}

Fixed version (ground truth):
private void filterListForCurrentText(){
  String text=mTagsEditText.getText().toString();
  int endIndex=text.lastIndexOf("String_Node_Str");
  if (endIndex == -1) {
    mAdapter.filter(text);
  }
 else {
    String textToFilter=text.substring(endIndex + 1);
    mAdapter.filter(textToFilter);
  }
}
Program: 13855
Project: 13855
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  String[] tagsArray;
  if (savedInstanceState == null) {
    mSite=(SiteModel)getIntent().getSerializableExtra(WordPress.SITE);
    tagsArray=getIntent().getStringArrayExtra(KEY_TAG_LIST);
  }
 else {
    mSite=(SiteModel)savedInstanceState.getSerializable(WordPress.SITE);
    tagsArray=savedInstanceState.getStringArray(KEY_TAG_LIST);
  }
  mTagList=tagsArray != null ? Arrays.asList(tagsArray) : new ArrayList<String>();
  if (mSite == null) {
    ToastUtils.showToast(this,R.string.blog_not_found,ToastUtils.Duration.SHORT);
    finish();
    return;
  }
  setContentView(R.layout.post_settings_tags_fragment);
  ActionBar actionBar=getSupportActionBar();
  if (actionBar != null) {
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
  }
  mTagsEditText=(SuggestionAutoCompleteText)findViewById(R.id.tags_edit_text);
  RecyclerView recyclerView=(RecyclerView)findViewById(R.id.tags_suggestion_list);
  recyclerView.setHasFixedSize(true);
  recyclerView.setLayoutManager(new LinearLayoutManager(this));
  mAdapter=new TagsRecyclerViewAdapter(this);
  recyclerView.setAdapter(mAdapter);
  String tags=TextUtils.join("String_Node_Str",mTagList);
  if (!tags.equals("String_Node_Str") && mTagsEditText != null) {
    mTagsEditText.setText(tags);
    mTagsEditText.addTextChangedListener(this);
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  String[] tagsArray=null;
  if (savedInstanceState == null) {
    mSite=(SiteModel)getIntent().getSerializableExtra(WordPress.SITE);
    tagsArray=getIntent().getStringArrayExtra(KEY_TAG_LIST);
  }
 else {
    mSite=(SiteModel)savedInstanceState.getSerializable(WordPress.SITE);
  }
  if (mSite == null) {
    ToastUtils.showToast(this,R.string.blog_not_found,ToastUtils.Duration.SHORT);
    finish();
    return;
  }
  setContentView(R.layout.post_settings_tags_fragment);
  ActionBar actionBar=getSupportActionBar();
  if (actionBar != null) {
    actionBar.setHomeButtonEnabled(true);
    actionBar.setDisplayHomeAsUpEnabled(true);
  }
  mTagsEditText=(SuggestionAutoCompleteText)findViewById(R.id.tags_edit_text);
  RecyclerView recyclerView=(RecyclerView)findViewById(R.id.tags_suggestion_list);
  recyclerView.setHasFixedSize(true);
  recyclerView.setLayoutManager(new LinearLayoutManager(this));
  mAdapter=new TagsRecyclerViewAdapter(this);
  recyclerView.setAdapter(mAdapter);
  if (mTagsEditText != null) {
    mTagsEditText.addTextChangedListener(this);
    String tags=TextUtils.join("String_Node_Str",tagsArray);
    if (!tags.equals("String_Node_Str")) {
      mTagsEditText.setText(tags);
    }
  }
}
Program: 13856
Project: 13856
Buggy source:
private void startGravatarUpload(final String filePath){
  File file=new File(filePath);
  if (!file.exists()) {
    Toast.makeText(getActivity(),getString(R.string.error_locating_image),Toast.LENGTH_SHORT).show();
    return;
  }
  showGravatarProgressBar(true);
  GravatarApi.uploadGravatar(file,mAccountStore.getAccount().getEmail(),mAccountStore.getAccessToken(),new GravatarApi.GravatarUploadListener(){
    @Override public void onSuccess(){
      EventBus.getDefault().post(new GravatarUploadFinished(filePath,true));
    }
    @Override public void onError(){
      EventBus.getDefault().post(new GravatarUploadFinished(filePath,false));
    }
  }
);
}

Fixed version (ground truth):
private void startGravatarUpload(final String filePath){
  if (TextUtils.isEmpty(filePath)) {
    Toast.makeText(getActivity(),getString(R.string.error_locating_image),Toast.LENGTH_SHORT).show();
    return;
  }
  File file=new File(filePath);
  if (!file.exists()) {
    Toast.makeText(getActivity(),getString(R.string.error_locating_image),Toast.LENGTH_SHORT).show();
    return;
  }
  showGravatarProgressBar(true);
  GravatarApi.uploadGravatar(file,mAccountStore.getAccount().getEmail(),mAccountStore.getAccessToken(),new GravatarApi.GravatarUploadListener(){
    @Override public void onSuccess(){
      EventBus.getDefault().post(new GravatarUploadFinished(filePath,true));
    }
    @Override public void onError(){
      EventBus.getDefault().post(new GravatarUploadFinished(filePath,false));
    }
  }
);
}
Program: 13857
Project: 13857
Buggy source:
private void fetchMedia(Uri mediaUri){
  if (!MediaUtils.isInMediaStore(mediaUri)) {
    Uri downloadedUri=MediaUtils.downloadExternalMedia(getActivity(),mediaUri);
    if (downloadedUri != null) {
      startGravatarUpload(getRealPathFromURI(downloadedUri));
    }
 else {
      Toast.makeText(getActivity(),getString(R.string.error_downloading_image),Toast.LENGTH_SHORT).show();
    }
  }
 else {
    startGravatarUpload(getRealPathFromURI(mediaUri));
  }
}

Fixed version (ground truth):
private void fetchMedia(Uri mediaUri){
  if (!MediaUtils.isInMediaStore(mediaUri)) {
    Uri downloadedUri=MediaUtils.downloadExternalMedia(getActivity(),mediaUri);
    if (downloadedUri != null) {
      startGravatarUpload(MediaUtils.getRealPathFromURI(getActivity(),downloadedUri));
    }
 else {
      Toast.makeText(getActivity(),getString(R.string.error_downloading_image),Toast.LENGTH_SHORT).show();
    }
  }
 else {
    startGravatarUpload(MediaUtils.getRealPathFromURI(getActivity(),mediaUri));
  }
}
Program: 13858
Project: 13858
Buggy source:
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
switch (requestCode) {
case RequestCodes.PICTURE_LIBRARY:
case RequestCodes.VIDEO_LIBRARY:
    if (resultCode == Activity.RESULT_OK && data != null) {
      Uri imageUri=data.getData();
      String mimeType=getContentResolver().getType(imageUri);
      fetchMedia(imageUri,mimeType);
      trackAddMediaFromDeviceEvents(false,requestCode == RequestCodes.VIDEO_LIBRARY,imageUri);
    }
  break;
case RequestCodes.TAKE_PHOTO:
if (resultCode == Activity.RESULT_OK) {
  Uri uri;
  Uri optimizedMedia=WPMediaUtils.getOptimizedMedia(this,mSite,mMediaCapturePath,false);
  if (optimizedMedia != null) {
    uri=optimizedMedia;
  }
 else {
    uri=Uri.parse(mMediaCapturePath);
  }
  mMediaCapturePath=null;
  queueFileForUpload(uri,getContentResolver().getType(uri));
  trackAddMediaFromDeviceEvents(true,false,uri);
}
break;
case RequestCodes.TAKE_VIDEO:
if (resultCode == Activity.RESULT_OK) {
Uri uri=MediaUtils.getLastRecordedVideoUri(this);
queueFileForUpload(uri,getContentResolver().getType(uri));
trackAddMediaFromDeviceEvents(true,true,uri);
}
break;
}
}

Fixed version (ground truth):
@Override public void onActivityResult(int requestCode,int resultCode,Intent data){
  super.onActivityResult(requestCode,resultCode,data);
switch (requestCode) {
case RequestCodes.PICTURE_LIBRARY:
case RequestCodes.VIDEO_LIBRARY:
    if (resultCode == Activity.RESULT_OK && data != null) {
      Uri imageUri=data.getData();
      String mimeType=getContentResolver().getType(imageUri);
      fetchMedia(imageUri,mimeType);
      trackAddMediaFromDeviceEvents(false,requestCode == RequestCodes.VIDEO_LIBRARY,imageUri);
    }
  break;
case RequestCodes.TAKE_PHOTO:
if (resultCode == Activity.RESULT_OK) {
  Uri uri=getOptimizedPictureIfNecessary(Uri.parse(mMediaCapturePath));
  mMediaCapturePath=null;
  queueFileForUpload(uri,getContentResolver().getType(uri));
  trackAddMediaFromDeviceEvents(true,false,uri);
}
break;
case RequestCodes.TAKE_VIDEO:
if (resultCode == Activity.RESULT_OK) {
Uri uri=MediaUtils.getLastRecordedVideoUri(this);
queueFileForUpload(uri,getContentResolver().getType(uri));
trackAddMediaFromDeviceEvents(true,true,uri);
}
break;
}
}
Program: 13859
Project: 13859
Buggy source:
private void fetchMedia(Uri mediaUri,final String mimeType){
  if (!MediaUtils.isInMediaStore(mediaUri)) {
    Uri downloadedUri=null;
    try {
      downloadedUri=MediaUtils.downloadExternalMedia(MediaBrowserActivity.this,mediaUri);
    }
 catch (    IllegalStateException e) {
      AppLog.e(AppLog.T.UTILS,"String_Node_Str" + mediaUri.toString(),e);
      CrashlyticsUtils.logException(e,AppLog.T.MEDIA,"String_Node_Str" + mediaUri.toString() + "String_Node_Str");
    }
    if (downloadedUri != null) {
      queueFileForUpload(downloadedUri,mimeType);
    }
 else {
      Toast.makeText(MediaBrowserActivity.this,getString(R.string.error_downloading_image),Toast.LENGTH_SHORT).show();
    }
  }
 else {
    queueFileForUpload(mediaUri,mimeType);
  }
}

Fixed version (ground truth):
private void fetchMedia(Uri mediaUri,final String mimeType){
  if (!MediaUtils.isInMediaStore(mediaUri)) {
    Uri downloadedUri=null;
    try {
      downloadedUri=MediaUtils.downloadExternalMedia(MediaBrowserActivity.this,mediaUri);
    }
 catch (    IllegalStateException e) {
      AppLog.e(AppLog.T.UTILS,"String_Node_Str" + mediaUri.toString(),e);
      CrashlyticsUtils.logException(e,AppLog.T.MEDIA,"String_Node_Str" + mediaUri.toString() + "String_Node_Str");
    }
    if (downloadedUri != null) {
      queueFileForUpload(getOptimizedPictureIfNecessary(downloadedUri),mimeType);
    }
 else {
      Toast.makeText(MediaBrowserActivity.this,getString(R.string.error_downloading_image),Toast.LENGTH_SHORT).show();
    }
  }
 else {
    queueFileForUpload(getOptimizedPictureIfNecessary(mediaUri),mimeType);
  }
}
Program: 13860
Project: 13860
Buggy source:
private void queueFileForUpload(Uri uri,String mimeType){
  String path=MediaUtils.getRealPathFromURI(this,uri);
  if (path == null || path.equals("String_Node_Str")) {
    Toast.makeText(this,"String_Node_Str",Toast.LENGTH_SHORT).show();
    return;
  }
  File file=new File(path);
  if (!file.exists()) {
    return;
  }
  MediaModel media=mMediaStore.instantiateMediaModel();
  String filename=org.wordpress.android.fluxc.utils.MediaUtils.getFileName(path);
  String fileExtension=org.wordpress.android.fluxc.utils.MediaUtils.getExtension(path);
  if (mimeType == null) {
    mimeType=getContentResolver().getType(uri);
    if (mimeType == null) {
      mimeType=MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension);
    }
    if (mimeType == null) {
      mimeType="String_Node_Str";
    }
  }
  if (fileExtension == null) {
    fileExtension=MimeTypeMap.getSingleton().getExtensionFromMimeType(mimeType);
    filename+="String_Node_Str" + fileExtension;
  }
  media.setFileName(filename);
  media.setFilePath(path);
  media.setLocalSiteId(mSite.getId());
  media.setFileExtension(fileExtension);
  media.setMimeType(mimeType);
  media.setUploadState(MediaUploadState.QUEUED.name());
  media.setUploadDate(DateTimeUtils.iso8601UTCFromTimestamp(System.currentTimeMillis() / 1000));
  mDispatcher.dispatch(MediaActionBuilder.newUpdateMediaAction(media));
  addMediaToUploadService(media);
}

Fixed version (ground truth):
private void queueFileForUpload(Uri uri,String mimeType){
  String path=MediaUtils.getRealPathFromURI(this,uri);
  if (TextUtils.isEmpty(path)) {
    Toast.makeText(this,getString(R.string.file_not_found),Toast.LENGTH_SHORT).show();
    return;
  }
  File file=new File(path);
  if (!file.exists()) {
    return;
  }
  MediaModel media=mMediaStore.instantiateMediaModel();
  String filename=org.wordpress.android.fluxc.utils.MediaUtils.getFileName(path);
  String fileExtension=org.wordpress.android.fluxc.utils.MediaUtils.getExtension(path);
  if (mimeType == null) {
    mimeType=getContentResolver().getType(uri);
    if (mimeType == null) {
      mimeType=MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension);
    }
    if (mimeType == null) {
      mimeType="String_Node_Str";
    }
  }
  if (fileExtension == null) {
    fileExtension=MimeTypeMap.getSingleton().getExtensionFromMimeType(mimeType);
    filename+="String_Node_Str" + fileExtension;
  }
  media.setFileName(filename);
  media.setFilePath(path);
  media.setLocalSiteId(mSite.getId());
  media.setFileExtension(fileExtension);
  media.setMimeType(mimeType);
  media.setUploadState(MediaUploadState.QUEUED.name());
  media.setUploadDate(DateTimeUtils.iso8601UTCFromTimestamp(System.currentTimeMillis() / 1000));
  mDispatcher.dispatch(MediaActionBuilder.newUpdateMediaAction(media));
  addMediaToUploadService(media);
}
Program: 13861
Project: 13861
Buggy source:
@Override protected Bitmap doInBackground(Void... params){
  byte[] bytes=ImageUtils.createThumbnailFromUri(MediaPreviewActivity.this,Uri.parse(mMediaUri),mSize,null,0);
  if (bytes != null) {
    return BitmapFactory.decodeByteArray(bytes,0,bytes.length);
  }
  return null;
}

Fixed version (ground truth):
@Override protected Bitmap doInBackground(Void... params){
  int orientation=ImageUtils.getImageOrientation(MediaPreviewActivity.this,mMediaUri);
  byte[] bytes=ImageUtils.createThumbnailFromUri(MediaPreviewActivity.this,Uri.parse(mMediaUri),mSize,null,orientation);
  if (bytes != null) {
    return BitmapFactory.decodeByteArray(bytes,0,bytes.length);
  }
  return null;
}
Program: 13862
Project: 13862
Buggy source:
private boolean addMediaVisualEditor(Uri uri,boolean isVideo){
  String path=MediaUtils.getRealPathFromURI(this,uri);
  if (path == null) {
    ToastUtils.showToast(this,R.string.file_not_found,Duration.SHORT);
    return false;
  }
  Uri optimizedMedia=WPMediaUtils.getOptimizedMedia(this,mSite,path,isVideo);
  if (optimizedMedia != null) {
    uri=optimizedMedia;
    path=MediaUtils.getRealPathFromURI(this,uri);
  }
 else {
    Uri rotatedMedia=WPMediaUtils.fixOrientationIssue(this,path,isVideo);
    if (rotatedMedia != null) {
      uri=rotatedMedia;
      path=MediaUtils.getRealPathFromURI(this,uri);
    }
  }
  MediaModel media=queueFileForUpload(uri,getContentResolver().getType(uri));
  MediaFile mediaFile=FluxCUtils.mediaFileFromMediaModel(media);
  if (media != null) {
    mEditorFragment.appendMediaFile(mediaFile,path,mImageLoader);
  }
  return true;
}

Fixed version (ground truth):
private boolean addMediaVisualEditor(Uri uri,boolean isVideo){
  String path=MediaUtils.getRealPathFromURI(this,uri);
  if (path == null) {
    ToastUtils.showToast(this,R.string.file_not_found,Duration.SHORT);
    return false;
  }
  Uri optimizedMedia=WPMediaUtils.getOptimizedMedia(this,mSite,path,isVideo);
  if (optimizedMedia != null) {
    uri=optimizedMedia;
    path=MediaUtils.getRealPathFromURI(this,uri);
  }
 else {
    if (!mSite.isWPCom()) {
      Uri rotatedMedia=WPMediaUtils.fixOrientationIssue(this,path,isVideo);
      if (rotatedMedia != null) {
        uri=rotatedMedia;
        path=MediaUtils.getRealPathFromURI(this,uri);
      }
    }
 else {
      if (mShowNewEditor) {
        Uri rotatedMedia=WPMediaUtils.fixOrientationIssue(this,path,isVideo);
        if (rotatedMedia != null) {
          path=MediaUtils.getRealPathFromURI(this,rotatedMedia);
        }
      }
    }
  }
  MediaModel media=queueFileForUpload(uri,getContentResolver().getType(uri));
  MediaFile mediaFile=FluxCUtils.mediaFileFromMediaModel(media);
  if (media != null) {
    mEditorFragment.appendMediaFile(mediaFile,path,mImageLoader);
  }
  return true;
}
Program: 13863
Project: 13863
Buggy source:
public static int getExifOrientation(String path){
  ExifInterface exif;
  try {
    exif=new ExifInterface(path);
  }
 catch (  IOException e) {
    AppLog.e(AppLog.T.UTILS,e);
    return 0;
  }
  int exifOrientation=exif.getAttributeInt(ExifInterface.TAG_ORIENTATION,0);
switch (exifOrientation) {
case ExifInterface.ORIENTATION_NORMAL:
    return 0;
case ExifInterface.ORIENTATION_ROTATE_90:
  return 90;
case ExifInterface.ORIENTATION_ROTATE_180:
return 180;
case ExifInterface.ORIENTATION_ROTATE_270:
return 270;
default :
return 0;
}
}

Fixed version (ground truth):
public static int getExifOrientation(String path){
  if (TextUtils.isEmpty(path)) {
    AppLog.w(AppLog.T.UTILS,"String_Node_Str");
    return 0;
  }
  ExifInterface exif;
  try {
    exif=new ExifInterface(path);
  }
 catch (  IOException e) {
    AppLog.e(AppLog.T.UTILS,"String_Node_Str",e);
    return 0;
  }
  int exifOrientation=exif.getAttributeInt(ExifInterface.TAG_ORIENTATION,0);
switch (exifOrientation) {
case ExifInterface.ORIENTATION_NORMAL:
    return 0;
case ExifInterface.ORIENTATION_ROTATE_90:
  return 90;
case ExifInterface.ORIENTATION_ROTATE_180:
return 180;
case ExifInterface.ORIENTATION_ROTATE_270:
return 270;
default :
return 0;
}
}
Program: 13864
Project: 13864
Buggy source:
public static int getImageOrientation(Context ctx,String filePath){
  Uri curStream;
  int orientation=0;
  filePath=filePath.replace("String_Node_Str","String_Node_Str");
  if (!filePath.contains("String_Node_Str"))   curStream=Uri.parse("String_Node_Str" + filePath);
 else   curStream=Uri.parse(filePath);
  try {
    Cursor cur=ctx.getContentResolver().query(curStream,new String[]{MediaStore.Images.Media.ORIENTATION},null,null,null);
    if (cur != null) {
      if (cur.moveToFirst()) {
        orientation=cur.getInt(cur.getColumnIndex(MediaStore.Images.Media.ORIENTATION));
      }
      cur.close();
    }
  }
 catch (  Exception errReadingContentResolver) {
    AppLog.e(AppLog.T.UTILS,errReadingContentResolver);
  }
  if (orientation == 0) {
    orientation=getExifOrientation(filePath);
  }
  return orientation;
}

Fixed version (ground truth):
public static int getImageOrientation(Context ctx,String filePath){
  if (TextUtils.isEmpty(filePath) || ctx == null) {
    AppLog.w(AppLog.T.UTILS,"String_Node_Str");
    return 0;
  }
  Uri curStream;
  int orientation=0;
  filePath=filePath.replace("String_Node_Str","String_Node_Str");
  if (!filePath.contains("String_Node_Str"))   curStream=Uri.parse("String_Node_Str" + filePath);
 else   curStream=Uri.parse(filePath);
  try {
    Cursor cur=ctx.getContentResolver().query(curStream,new String[]{MediaStore.Images.Media.ORIENTATION},null,null,null);
    if (cur != null) {
      if (cur.moveToFirst()) {
        orientation=cur.getInt(cur.getColumnIndex(MediaStore.Images.Media.ORIENTATION));
      }
      cur.close();
    }
  }
 catch (  Exception errReadingContentResolver) {
    AppLog.e(AppLog.T.UTILS,"String_Node_Str" + filePath,errReadingContentResolver);
  }
  if (orientation == 0) {
    orientation=getExifOrientation(filePath);
  }
  return orientation;
}
Program: 13867
Project: 13867
Buggy source:
private void updateSiteOrFinishActivity(Bundle savedInstanceState){
  if (savedInstanceState == null) {
    if (getArguments() != null) {
      mSite=(SiteModel)getArguments().getSerializable(WordPress.SITE);
    }
 else {
      mSite=(SiteModel)getActivity().getIntent().getSerializableExtra(WordPress.SITE);
    }
  }
 else {
    mSite=(SiteModel)savedInstanceState.getSerializable(WordPress.SITE);
  }
  if (mSite == null) {
    ToastUtils.showToast(getActivity(),R.string.blog_not_found,ToastUtils.Duration.SHORT);
    getActivity().finish();
  }
}

Fixed version (ground truth):
private void updateSiteOrFinishActivity(){
  if (getArguments() != null) {
    mSite=(SiteModel)getArguments().getSerializable(WordPress.SITE);
  }
 else {
    mSite=(SiteModel)getActivity().getIntent().getSerializableExtra(WordPress.SITE);
  }
  if (mSite == null) {
    ToastUtils.showToast(getActivity(),R.string.blog_not_found,ToastUtils.Duration.SHORT);
    getActivity().finish();
  }
}
Program: 13868
Project: 13868
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  updateSiteOrFinishActivity(savedInstanceState);
  setRetainInstance(true);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  updateSiteOrFinishActivity();
  if (savedInstanceState != null) {
    String roleValue=savedInstanceState.getString(KEY_SELECTED_ROLE);
    if (!TextUtils.isEmpty(roleValue)) {
      mRole=Role.fromString(roleValue);
    }
    ArrayList<String> retainedUsernames=savedInstanceState.getStringArrayList(KEY_USERNAMES);
    if (retainedUsernames != null) {
      mUsernames.clear();
      mUsernames.addAll(retainedUsernames);
    }
  }
  setRetainInstance(true);
}
Program: 13870
Project: 13870
Buggy source:
@Override public boolean onPrepareOptionsMenu(Menu menu){
  boolean showEditMenu=mMediaId != 0 && mSite != null && mEnableMetadata && !hasEditFragment();
  boolean showSaveMenu=mMediaId != 0 && mSite != null && !mSite.isPrivate();
  boolean showShareMenu=mMediaId != 0 && mSite != null && !mSite.isPrivate();
  MenuItem mnuEdit=menu.findItem(R.id.menu_edit);
  mnuEdit.setVisible(showEditMenu);
  MenuItem mnuSave=menu.findItem(R.id.menu_save);
  mnuSave.setVisible(showSaveMenu);
  mnuSave.setEnabled(mDownloadId == 0);
  MenuItem mnuShare=menu.findItem(R.id.menu_share);
  mnuShare.setVisible(showShareMenu);
  return super.onPrepareOptionsMenu(menu);
}

Fixed version (ground truth):
@Override public boolean onPrepareOptionsMenu(Menu menu){
  boolean showEditMenu=mMediaId != 0 && mSite != null && mEnableMetadata && !mIsClosable;
  boolean showSaveMenu=mMediaId != 0 && mSite != null && !mSite.isPrivate();
  boolean showShareMenu=mMediaId != 0 && mSite != null && !mSite.isPrivate();
  MenuItem mnuEdit=menu.findItem(R.id.menu_edit);
  mnuEdit.setVisible(showEditMenu);
  MenuItem mnuSave=menu.findItem(R.id.menu_save);
  mnuSave.setVisible(showSaveMenu);
  mnuSave.setEnabled(mDownloadId == 0);
  MenuItem mnuShare=menu.findItem(R.id.menu_share);
  mnuShare.setVisible(showShareMenu);
  return super.onPrepareOptionsMenu(menu);
}
Program: 13871
Project: 13871
Buggy source:
private void setLookClosable(boolean lookClosable){
  if (mToolbar != null) {
    mToolbar.setNavigationIcon(lookClosable ? R.drawable.ic_close_white_24dp : R.drawable.ic_arrow_left_white_24dp);
  }
}

Fixed version (ground truth):
private void setLookClosable(boolean lookClosable){
  mIsClosable=lookClosable;
  if (mToolbar != null) {
    mToolbar.setNavigationIcon(lookClosable ? R.drawable.ic_close_white_24dp : R.drawable.ic_arrow_left_white_24dp);
  }
}
Program: 13872
Project: 13872
Buggy source:
private Uri getOptimizedPictureIfNecessary(Uri originalUri){
  String filePath=MediaUtils.getRealPathFromURI(this,originalUri);
  if (TextUtils.isEmpty(filePath)) {
    return originalUri;
  }
  Uri optimizedMedia=WPMediaUtils.getOptimizedMedia(this,mSite,filePath,false);
  if (optimizedMedia != null) {
    return optimizedMedia;
  }
  return originalUri;
}

Fixed version (ground truth):
private Uri getOptimizedPictureIfNecessary(Uri originalUri){
  String filePath=MediaUtils.getRealPathFromURI(this,originalUri);
  if (TextUtils.isEmpty(filePath)) {
    return originalUri;
  }
  Uri optimizedMedia=WPMediaUtils.getOptimizedMedia(this,mSite,filePath,false);
  if (optimizedMedia != null) {
    return optimizedMedia;
  }
 else {
    if (!mSite.isWPCom()) {
      Uri rotatedMedia=WPMediaUtils.fixOrientationIssue(this,filePath,false);
      if (rotatedMedia != null) {
        return rotatedMedia;
      }
    }
  }
  return originalUri;
}
Program: 13875
Project: 13875
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ((WordPress)getApplication()).component().inject(this);
  setContentView(R.layout.welcome_activity);
  if (savedInstanceState == null) {
    addLoginPrologueFragment();
  }
  mLoginNavigationController=new LoginNavigationController(LoginState.PROLOGUE,this);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ((WordPress)getApplication()).component().inject(this);
  setContentView(R.layout.welcome_activity);
  if (savedInstanceState == null) {
    addLoginPrologueFragment();
  }
}
Program: 13876
Project: 13876
Buggy source:
@Override public Dialog onCreateDialog(Bundle savedInstanceState){
  if (savedInstanceState != null) {
    mPostExcerpt=savedInstanceState.getString(EXCERPT_TAG,"String_Node_Str");
  }
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivity(),R.style.Calypso_AlertDialog);
  LayoutInflater factory=LayoutInflater.from(getActivity());
  View textEntryView=factory.inflate(R.layout.post_excerpt_dialog,null);
  builder.setView(textEntryView);
  builder.setTitle(R.string.post_excerpt);
  builder.setNegativeButton(R.string.cancel,null);
  builder.setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
    }
  }
);
  AlertDialog dialog=builder.create();
  EditText editText=(EditText)textEntryView.findViewById(R.id.post_excerpt_dialog_edit_text);
  editText.setText(mPostExcerpt);
  return dialog;
}

Fixed version (ground truth):
@Override public Dialog onCreateDialog(Bundle savedInstanceState){
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivity(),R.style.Calypso_AlertDialog);
  LayoutInflater factory=LayoutInflater.from(getActivity());
  View textEntryView=factory.inflate(R.layout.post_excerpt_dialog,null);
  builder.setView(textEntryView);
  builder.setTitle(R.string.post_excerpt);
  builder.setNegativeButton(R.string.cancel,null);
  builder.setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
    }
  }
);
  AlertDialog dialog=builder.create();
  EditText editText=(EditText)textEntryView.findViewById(R.id.post_excerpt_dialog_edit_text);
  editText.setText(mPostExcerpt);
  return dialog;
}
Program: 13877
Project: 13877
Buggy source:
public static SignInDialogFragment newInstance(String title,String message,int imageSource,int numberOfButtons,String firstButtonLabel,String secondButtonLabel,String thirdButtonLabel,int firstButtonAction,int secondButtonAction,int thirdButtonAction,String tellMeMoreButtonFaqId,String tellMeMoreButtonSectionId){
  SignInDialogFragment adf=new SignInDialogFragment();
  Bundle bundle=new Bundle();
  bundle.putString(ARG_TITLE,title);
  bundle.putString(ARG_DESCRIPTION,message);
  bundle.putInt(ARG_IMAGE,imageSource);
  bundle.putInt(ARG_NUMBER_OF_BUTTONS,numberOfButtons);
  bundle.putString(ARG_FIRST_BUTTON_LABEL,firstButtonLabel);
  bundle.putString(ARG_SECOND_BUTTON_LABEL,secondButtonLabel);
  bundle.putString(ARG_THIRD_BUTTON_LABEL,thirdButtonLabel);
  bundle.putInt(ARG_FIRST_BUTTON_ACTION,firstButtonAction);
  bundle.putInt(ARG_SECOND_BUTTON_ACTION,secondButtonAction);
  bundle.putInt(ARG_THIRD_BUTTON_ACTION,thirdButtonAction);
  bundle.putString(ARG_TELL_ME_MORE_BUTTON_PARAM_NAME_FAQ_ID,tellMeMoreButtonFaqId);
  bundle.putString(ARG_TELL_ME_MORE_BUTTON_PARAM_NAME_SECTION_ID,tellMeMoreButtonSectionId);
  adf.setArguments(bundle);
  adf.setStyle(DialogFragment.STYLE_NO_TITLE,android.R.style.Theme);
  return adf;
}

Fixed version (ground truth):
public static SignInDialogFragment newInstance(String title,String message,int imageSource,int numberOfButtons,String firstButtonLabel,String secondButtonLabel,String thirdButtonLabel,int secondButtonAction,int thirdButtonAction,String tellMeMoreButtonFaqId,String tellMeMoreButtonSectionId){
  SignInDialogFragment adf=new SignInDialogFragment();
  Bundle bundle=new Bundle();
  bundle.putString(ARG_TITLE,title);
  bundle.putString(ARG_DESCRIPTION,message);
  bundle.putInt(ARG_IMAGE,imageSource);
  bundle.putInt(ARG_NUMBER_OF_BUTTONS,numberOfButtons);
  bundle.putString(ARG_FIRST_BUTTON_LABEL,firstButtonLabel);
  bundle.putString(ARG_SECOND_BUTTON_LABEL,secondButtonLabel);
  bundle.putString(ARG_THIRD_BUTTON_LABEL,thirdButtonLabel);
  bundle.putInt(ARG_SECOND_BUTTON_ACTION,secondButtonAction);
  bundle.putInt(ARG_THIRD_BUTTON_ACTION,thirdButtonAction);
  bundle.putString(ARG_TELL_ME_MORE_BUTTON_PARAM_NAME_FAQ_ID,tellMeMoreButtonFaqId);
  bundle.putString(ARG_TELL_ME_MORE_BUTTON_PARAM_NAME_SECTION_ID,tellMeMoreButtonSectionId);
  adf.setArguments(bundle);
  adf.setStyle(DialogFragment.STYLE_NO_TITLE,android.R.style.Theme);
  return adf;
}