[Demonstration 1]

[Buggy Method]
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View listView = inflater.inflate(R.layout.list_fragment, container, false);
    mGridView = (GridView) listView.findViewById(R.id.grid_view);
    TextView emptyView = (TextView) listView.findViewById(android.R.id.empty);
    mGridView.setEmptyView(emptyView);
    return listView;
}

[Buggy Hunk]
TextView emptyView = (TextView) listView.findViewById(android.R.id.empty);

[Patch]
emptyView = (TextView) listView.findViewById(android.R.id.empty);

[Demonstration 2]

[Buggy Method]
private void reloadYouTubeMedia(final boolean loadLatest) {
    final String accountName = mCredential.getSelectedAccountName();
    if (TextUtils.isEmpty(accountName)) {
        mLoading = false;
        return;
    }
    new AsyncTask<Void, Void, List<Video>>() {

        @Override
        protected List<Video> doInBackground(Void... voids) {
            if (!isAdded()) {
                return null;
            }
            YouTube youtube = new YouTube.Builder(HTTP_TRANSPORT, JSON_FACTORY, mCredential).setApplicationName(getString(R.string.app_name)).build();
            try {
                /*
                     * Now that the user is authenticated, the app makes a channels list request
					 * to get the authenticated user's channel. Returned with that data is the
					 * playlist id for the uploaded videos.
					 * https://developers.google.com/youtube/v3/docs/channels/list
					 */
                ChannelListResponse clr = youtube.channels().list("contentDetails").setMine(true).execute();
                // Get the user's uploads playlist's id from channel list response
                String watchHistoryPlaylistIds = clr.getItems().get(0).getContentDetails().getRelatedPlaylists().getLikes();
                // Get videos from user's upload playlist with a playlist items list request
                PlaylistItemListResponse pilr = youtube.playlistItems().list("id,contentDetails,snippet").setPlaylistId(watchHistoryPlaylistIds).setPageToken(loadLatest ? null : mNextPageToken).setMaxResults(MAX_NUMBER_OF_ITEMS).execute();
                // Get page token for further loading
                if (loadLatest) {
                    // First load
                    if (mNextPageToken == null) {
                        mNextPageToken = pilr.getNextPageToken();
                    }
                } else {
                    mTokenSet.add(mNextPageToken);
                    mNextPageToken = pilr.getNextPageToken();
                }
                // Iterate over playlist item list response to get uploaded videos' ids and last watched time
                LinkedHashMap<String, String> watchedVideos = new LinkedHashMap<>();
                for (PlaylistItem item : pilr.getItems()) {
                    watchedVideos.put(item.getContentDetails().getVideoId(), item.getSnippet().getPublishedAt().toString());
                }
                // Get details of uploaded videos with a videos list request.
                VideoListResponse vlr = youtube.videos().list("id,snippet,status,statistics,contentDetails").setId(TextUtils.join(",", watchedVideos.keySet())).execute();
                // Add only the public videos to the local videos list.
                List<Video> videos = new ArrayList<>();
                for (com.google.api.services.youtube.model.Video youtubeVideo : vlr.getItems()) {
                    if ("public".equals(youtubeVideo.getStatus().getPrivacyStatus())) {
                        Video video = Video.fromYoutubeVideo(youtubeVideo, watchedVideos.get(youtubeVideo.getId()));
                        videos.add(video);
                    }
                }
                return videos;
            } catch (final GooglePlayServicesAvailabilityIOException availabilityException) {
                showGooglePlayServicesAvailabilityErrorDialog(availabilityException.getConnectionStatusCode());
            } catch (UserRecoverableAuthIOException userRecoverableException) {
                startActivityForResult(userRecoverableException.getIntent(), TrackerActivity.REQUEST_AUTHORIZATION);
            } catch (IOException e) {
                LOGE(TAG, e.getMessage());
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                mLoading = false;
            }
            return null;
        }

        @Override
        protected void onPostExecute(List<Video> videos) {
            if (isAdded() && videos != null) {
                LOGD(TAG, "Load videos successfully: " + videos);
                mMediaAdapter.updateVideos(videos, loadLatest);
                cacheLocalVideos(videos);
                if (mLoadingPannel.getVisibility() == View.VISIBLE) {
                    mMediaView.setPadding(mMediaView.getPaddingLeft(), mMediaView.getPaddingTop(), mMediaView.getPaddingRight(), mMediaView.getPaddingBottom() - mLoadingPannel.getHeight());
                }
                mProgressView.setVisibility(View.GONE);
                mLoadingPannel.setVisibility(View.GONE);
                mMediaSwipeRefresh.setRefreshing(false);
            }
        }
    }.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
}

[Buggy Hunk]
videos.add(video);

[Patch]
if (video != null) videos.add(video);

[Demonstration 3]

[Buggy Method]
@Override
public void onBindViewHolder(final RecyclerView.ViewHolder viewHolder, int position) {
    switch(viewHolder.getItemViewType()) {
        case VIEW_TYPE_ARTICLE:
            Article article = (Article) contents.get(position);
            ArticleViewHolder articleViewHolder = (ArticleViewHolder) viewHolder;
            Picasso.with(viewHolder.itemView.getContext()).load(article.getThumbnails().get(2).getUrl()).into(articleViewHolder.thumbnail);
            articleViewHolder.articleTitle.setText(Html.fromHtml(article.getMetaData().getHeadline()));
            articleViewHolder.time.setText(Html.fromHtml(article.getMetaData().getPublishDate()));
            break;
        case VIEW_TYPE_VIDEO:
            ArrayList<Video> videos = (ArrayList<Video>) contents.get(position);
            VideoListViewHolder videoListViewHolder = (VideoListViewHolder) viewHolder;
            videoListViewHolder.setVideos(videos);
            break;
    }
}

[Buggy Hunk]
ArrayList<Video> videos = (ArrayList<Video>) contents.get(position);

[Patch]
ArrayList<Video> videos = (ArrayList) contents.get(position);