Program: 14340
Project: 14340
Buggy source:
private void showPagePopupMenu(View view,int position){
  final PostsListPost page=getItem(position);
  if (page == null || mOnPostButtonClickListener == null) {
    return;
  }
  Context context=view.getContext();
  PopupMenu popup=new PopupMenu(context,view);
  boolean showViewItem=!page.isLocalDraft() && page.getStatusEnum() == PostStatus.PUBLISHED;
  boolean showStatsItem=!page.isLocalDraft() && page.getStatusEnum() == PostStatus.PUBLISHED;
  boolean showEditItem=true;
  boolean showTrashItem=!page.isLocalDraft();
  boolean showDeleteItem=!showTrashItem;
  if (showViewItem) {
    MenuItem mnuView=popup.getMenu().add(context.getString(R.string.button_view));
    mnuView.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener(){
      @Override public boolean onMenuItemClick(      MenuItem item){
        mOnPostButtonClickListener.onPostButtonClicked(PostListButton.BUTTON_VIEW,page);
        return true;
      }
    }
);
  }
  if (showStatsItem) {
    MenuItem mnuStats=popup.getMenu().add(context.getString(R.string.button_stats));
    mnuStats.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener(){
      @Override public boolean onMenuItemClick(      MenuItem item){
        mOnPostButtonClickListener.onPostButtonClicked(PostListButton.BUTTON_STATS,page);
        return true;
      }
    }
);
  }
  if (showEditItem) {
    MenuItem mnuEdit=popup.getMenu().add(context.getString(R.string.button_edit));
    mnuEdit.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener(){
      @Override public boolean onMenuItemClick(      MenuItem item){
        mOnPostButtonClickListener.onPostButtonClicked(PostListButton.BUTTON_EDIT,page);
        return true;
      }
    }
);
  }
  if (showTrashItem) {
    MenuItem mnuTrash=popup.getMenu().add(context.getString(R.string.button_trash));
    mnuTrash.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener(){
      @Override public boolean onMenuItemClick(      MenuItem item){
        mOnPostButtonClickListener.onPostButtonClicked(PostListButton.BUTTON_TRASH,page);
        return true;
      }
    }
);
  }
  if (showDeleteItem) {
    MenuItem mnuDelete=popup.getMenu().add(context.getString(R.string.button_delete));
    mnuDelete.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener(){
      @Override public boolean onMenuItemClick(      MenuItem item){
        mOnPostButtonClickListener.onPostButtonClicked(PostListButton.BUTTON_DELETE,page);
        return true;
      }
    }
);
  }
  popup.show();
}

Fixed version (ground truth):
private void showPagePopupMenu(View view,final PostsListPost page){
  if (page == null || mOnPostButtonClickListener == null) {
    return;
  }
  Context context=view.getContext();
  PopupMenu popup=new PopupMenu(context,view);
  boolean showViewItem=!page.isLocalDraft() && page.getStatusEnum() == PostStatus.PUBLISHED;
  boolean showStatsItem=!page.isLocalDraft() && page.getStatusEnum() == PostStatus.PUBLISHED;
  boolean showEditItem=true;
  boolean showTrashItem=!page.isLocalDraft();
  boolean showDeleteItem=!showTrashItem;
  if (showViewItem) {
    MenuItem mnuView=popup.getMenu().add(context.getString(R.string.button_view));
    mnuView.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener(){
      @Override public boolean onMenuItemClick(      MenuItem item){
        mOnPostButtonClickListener.onPostButtonClicked(PostListButton.BUTTON_VIEW,page);
        return true;
      }
    }
);
  }
  if (showStatsItem) {
    MenuItem mnuStats=popup.getMenu().add(context.getString(R.string.button_stats));
    mnuStats.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener(){
      @Override public boolean onMenuItemClick(      MenuItem item){
        mOnPostButtonClickListener.onPostButtonClicked(PostListButton.BUTTON_STATS,page);
        return true;
      }
    }
);
  }
  if (showEditItem) {
    MenuItem mnuEdit=popup.getMenu().add(context.getString(R.string.button_edit));
    mnuEdit.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener(){
      @Override public boolean onMenuItemClick(      MenuItem item){
        mOnPostButtonClickListener.onPostButtonClicked(PostListButton.BUTTON_EDIT,page);
        return true;
      }
    }
);
  }
  if (showTrashItem) {
    MenuItem mnuTrash=popup.getMenu().add(context.getString(R.string.button_trash));
    mnuTrash.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener(){
      @Override public boolean onMenuItemClick(      MenuItem item){
        mOnPostButtonClickListener.onPostButtonClicked(PostListButton.BUTTON_TRASH,page);
        return true;
      }
    }
);
  }
  if (showDeleteItem) {
    MenuItem mnuDelete=popup.getMenu().add(context.getString(R.string.button_delete));
    mnuDelete.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener(){
      @Override public boolean onMenuItemClick(      MenuItem item){
        mOnPostButtonClickListener.onPostButtonClicked(PostListButton.BUTTON_DELETE,page);
        return true;
      }
    }
);
  }
  popup.show();
}