Program: 13497
Project: 13497
Buggy source:
@Override public void onBindViewHolder(GridViewHolder holder,int position){
  if (!isValidPosition(position)) {
    return;
  }
  MediaModel media=mMediaList.get(position);
  holder.mImageView.setTag(null);
  String strState=media.getUploadState();
  MediaUploadState state=MediaUploadState.fromString(strState);
  boolean isLocalFile=MediaUtils.isLocalFile(strState) && !TextUtils.isEmpty(media.getFilePath());
  boolean isSelected=isItemSelected(media.getId());
  boolean canSelect=canSelectPosition(position);
  boolean isImage=media.getMimeType() != null && media.getMimeType().startsWith("String_Node_Str");
  if (!mLoadThumbnails) {
    holder.mFileContainer.setVisibility(View.GONE);
    holder.mImageView.setImageUrl(null,WPNetworkImageView.ImageType.PHOTO);
  }
 else   if (isImage) {
    holder.mFileContainer.setVisibility(View.GONE);
    if (isLocalFile) {
      loadLocalImage(media.getFilePath(),holder.mImageView);
    }
 else {
      holder.mImageView.setImageUrl(getBestImageUrl(media),WPNetworkImageView.ImageType.PHOTO);
    }
  }
 else   if (media.isVideo()) {
    holder.mFileContainer.setVisibility(View.GONE);
    loadVideoThumbnail(media,holder.mImageView);
  }
 else {
    holder.mImageView.setImageDrawable(null);
    String fileName=media.getFileName();
    String title=media.getTitle();
    String fileExtension=MediaUtils.getExtensionForMimeType(media.getMimeType());
    holder.mFileContainer.setVisibility(View.VISIBLE);
    holder.mTitleView.setText(TextUtils.isEmpty(title) ? fileName : title);
    holder.mFileTypeView.setText(fileExtension.toUpperCase());
    int placeholderResId=WPMediaUtils.getPlaceholder(fileName);
    holder.mFileTypeImageView.setImageResource(placeholderResId);
  }
  if (mBrowserType.canMultiselect() && canSelect) {
    holder.mSelectionCountContainer.setVisibility(View.VISIBLE);
    holder.mSelectionCountTextView.setVisibility(View.VISIBLE);
    holder.mSelectionCountTextView.setSelected(isSelected);
    if (isSelected) {
      int count=mSelectedItems.indexOf(media.getId()) + 1;
      holder.mSelectionCountTextView.setText(Integer.toString(count));
    }
 else {
      holder.mSelectionCountTextView.setText(null);
    }
  }
 else {
    holder.mSelectionCountContainer.setVisibility(View.GONE);
    holder.mSelectionCountTextView.setVisibility(View.GONE);
  }
  float scale=isSelected ? SCALE_SELECTED : SCALE_NORMAL;
  if (holder.mImageView.getScaleX() != scale) {
    holder.mImageView.setScaleX(scale);
    holder.mImageView.setScaleY(scale);
  }
  if (state != MediaUploadState.UPLOADED) {
    holder.mStateContainer.setVisibility(View.VISIBLE);
    boolean showProgress=state == MediaUploadState.UPLOADING || state == MediaUploadState.DELETING;
    holder.mProgressUpload.setVisibility(showProgress ? View.VISIBLE : View.GONE);
    if (state == MediaUploadState.FAILED || state == MediaUploadState.QUEUED) {
      holder.mRetryDeleteContainer.setVisibility(View.VISIBLE);
      holder.mImgRetry.setVisibility(state == MediaUploadState.FAILED ? View.VISIBLE : View.GONE);
    }
 else {
      holder.mRetryDeleteContainer.setVisibility(View.GONE);
    }
    holder.mStateTextView.setText(getLabelForMediaUploadState(state));
    holder.mVideoOverlayContainer.setVisibility(View.GONE);
  }
 else {
    holder.mStateContainer.setVisibility(View.GONE);
    holder.mStateContainer.setOnClickListener(null);
    holder.mVideoOverlayContainer.setVisibility(media.isVideo() ? View.VISIBLE : View.GONE);
  }
  if (position == getItemCount() - 1 && !mHasRetrievedAll && mCallback != null) {
    mCallback.onAdapterFetchMoreData();
  }
}

Fixed version (ground truth):
@Override public void onBindViewHolder(GridViewHolder holder,int position){
  if (!isValidPosition(position)) {
    return;
  }
  MediaModel media=mMediaList.get(position);
  holder.mImageView.setTag(null);
  String strState=media.getUploadState();
  MediaUploadState state=MediaUploadState.fromString(strState);
  boolean isLocalFile=MediaUtils.isLocalFile(strState) && !TextUtils.isEmpty(media.getFilePath());
  boolean isSelected=isItemSelected(media.getId());
  boolean canSelect=canSelectPosition(position);
  boolean isImage=media.getMimeType() != null && media.getMimeType().startsWith("String_Node_Str");
  if (!mLoadThumbnails) {
    holder.mFileContainer.setVisibility(View.GONE);
    holder.mImageView.setImageUrl(null,WPNetworkImageView.ImageType.PHOTO);
  }
 else   if (isImage) {
    holder.mFileContainer.setVisibility(View.GONE);
    if (isLocalFile) {
      loadLocalImage(media.getFilePath(),holder.mImageView);
    }
 else {
      holder.mImageView.setImageUrl(getBestImageUrl(media),WPNetworkImageView.ImageType.PHOTO);
    }
  }
 else   if (media.isVideo()) {
    holder.mFileContainer.setVisibility(View.GONE);
    loadVideoThumbnail(media,holder.mImageView);
  }
 else {
    holder.mImageView.setImageDrawable(null);
    String fileName=media.getFileName();
    String title=media.getTitle();
    String fileExtension=MediaUtils.getExtensionForMimeType(media.getMimeType());
    holder.mFileContainer.setVisibility(View.VISIBLE);
    holder.mTitleView.setText(TextUtils.isEmpty(title) ? fileName : title);
    holder.mFileTypeView.setText(fileExtension.toUpperCase(Locale.ROOT));
    int placeholderResId=WPMediaUtils.getPlaceholder(fileName);
    holder.mFileTypeImageView.setImageResource(placeholderResId);
  }
  if (mBrowserType.canMultiselect() && canSelect) {
    holder.mSelectionCountContainer.setVisibility(View.VISIBLE);
    holder.mSelectionCountTextView.setVisibility(View.VISIBLE);
    holder.mSelectionCountTextView.setSelected(isSelected);
    if (isSelected) {
      int count=mSelectedItems.indexOf(media.getId()) + 1;
      holder.mSelectionCountTextView.setText(Integer.toString(count));
    }
 else {
      holder.mSelectionCountTextView.setText(null);
    }
  }
 else {
    holder.mSelectionCountContainer.setVisibility(View.GONE);
    holder.mSelectionCountTextView.setVisibility(View.GONE);
  }
  float scale=isSelected ? SCALE_SELECTED : SCALE_NORMAL;
  if (holder.mImageView.getScaleX() != scale) {
    holder.mImageView.setScaleX(scale);
    holder.mImageView.setScaleY(scale);
  }
  if (state != MediaUploadState.UPLOADED) {
    holder.mStateContainer.setVisibility(View.VISIBLE);
    boolean showProgress=state == MediaUploadState.UPLOADING || state == MediaUploadState.DELETING;
    holder.mProgressUpload.setVisibility(showProgress ? View.VISIBLE : View.GONE);
    if (state == MediaUploadState.FAILED || state == MediaUploadState.QUEUED) {
      holder.mRetryDeleteContainer.setVisibility(View.VISIBLE);
      holder.mImgRetry.setVisibility(state == MediaUploadState.FAILED ? View.VISIBLE : View.GONE);
    }
 else {
      holder.mRetryDeleteContainer.setVisibility(View.GONE);
    }
    holder.mStateTextView.setText(getLabelForMediaUploadState(state));
    holder.mVideoOverlayContainer.setVisibility(View.GONE);
  }
 else {
    holder.mStateContainer.setVisibility(View.GONE);
    holder.mStateContainer.setOnClickListener(null);
    holder.mVideoOverlayContainer.setVisibility(media.isVideo() ? View.VISIBLE : View.GONE);
  }
  if (position == getItemCount() - 1 && !mHasRetrievedAll && mCallback != null) {
    mCallback.onAdapterFetchMoreData();
  }
}