[Demonstration 1]

[Buggy Method]
public void configureThumbnailList(ArrayList listData, String adapterType) {
    // set the thumbnail list adapter so it will display the items
    // TODO: I could change what kind of adapter is used depending on the type of list we want,
    // such as a list of movies vs. a list of playlists.
    // Right now it is being handled by conditionals within the ThumbnailListAdapter, but this is getting a bit messy.
    // Query what kind of list it is, based on the data, then send a different type of adapter in,
    // such as PlaylistAdapter.
    // We could have: PlaylistsAdapter, PlaylistAdapter, FavoritesAdapter, SoundboardsAdapter, SectionAdapter, PurchasedAdapter
    // These should be based on an interface or a superclass to keep them consistent.
    //TODO: base this on the "cat" setting on the objects?
    Log.d(LOGVAR, "adapterType: " + adapterType);
    if (adapterType == "section") {
        SectionAdapter adapter = new SectionAdapter(listData, this);
        thumbnailList.setAdapter(adapter);
    } else if (adapterType == "videos") {
        videoAdapter = new VideosAdapter(listData, this, "");
        thumbnailList.setAdapter(videoAdapter);
    } else if (adapterType == "playlists") {
        PlaylistAdapter adapter = new PlaylistAdapter(listData, this);
        thumbnailList.setAdapter(adapter);
    } else if (adapterType == "playlistItems") {
        PlaylistItemAdapter adapter = new PlaylistItemAdapter(listData, this);
        thumbnailList.setAdapter(adapter);
    } else if (adapterType == "purchased") {
        VideosAdapter purchasedAdapter = new VideosAdapter(listData, this, "purchased");
        thumbnailList.setAdapter(purchasedAdapter);
    } else /* else if (adapterType == "favorites") {
            FavoritesAdapter adapter = new FavoritesAdapter(listData, this);
            thumbnailList.setAdapter(adapter);
        } */
    if (adapterType == "soundBoards") {
        SoundBoardsAdapter adapter = new SoundBoardsAdapter(listData, this);
        thumbnailList.setAdapter(adapter);
    } else {
        ThumbnailListAdapter adapter = new ThumbnailListAdapter(listData, this);
        thumbnailList.setAdapter(adapter);
    }
}

[Buggy Hunk]
} else if (adapterType == "videos") {

[Patch]
} else if (adapterType == "videos" || adapterType == "favorites") {

[Demonstration 2]

[Buggy Method]
@Override
public boolean updateCache(ContentValues values, String whereClause, String[] whereArgs) {
    boolean flag = false;
    SQLiteDatabase database = null;
    int count = 0;
    try {
        database = helper.getWritableDatabase();
        // count = database.update(SQLHelper.TABLE_CHANNEL, values,
        // whereClause, whereArgs);
        database.execSQL("update " + SQLHelper.TABLE_CHANNEL + " set selected = " + values.getAsString("selected") + " where id = " + values.getAsString("id"));
        flag = (count > 0 ? true : false);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        if (database != null) {
            database.endTransaction();
            database.close();
        }
    }
    return flag;
}

[Buggy Hunk]
+ values.getAsString("selected") + " where id = " + values.getAsString("id"));

[Patch]
+ values.getAsString("selected") + " where name = \"" + values.getAsString("name") +"\"");

[Demonstration 3]

[Buggy Method]
public static void rebuildGraphSet() {
    Debugger.startTask("rebuildGraphSet", new OnTaskFinishedListener() {

        @Override
        public void onTaskFinished() {
            Debugger.log("共有: " + String.valueOf(Mining.smDataSet.size()) + "\n");
        }
    });
    Mining.wmDataSet = new Mining.WeekMiningData[wmaxEdgeLabel];
    Set<Graph> graphSet = GraphSet.getGraphSet();
    for (Iterator<Graph> it = graphSet.iterator(); it.hasNext(); ) {
        Graph g = it.next();
        Set<Edge> edges = g.getEdges();
        boolean hasNoCandidates = true;
        for (Iterator<Edge> eit = edges.iterator(); eit.hasNext(); ) {
            Edge e = eit.next();
            int ver2Label = g.vertex2Rank.get(e.vertex2);
            StrongMiningData md = new StrongMiningData(e.label, ver2Label);
            int ver2Rank = vertexLabel2Rank[ver2Label];
            int edgeRank = edgeLabel2Rank[e.label];
            g.vertex2Rank.put(e.vertex2, ver2Rank);
            e.label = edgeRank;
            // deal with strong pattern
            if (md2Freq.get(md) >= Mining.MIN_SUPPORT) {
                hasNoCandidates = false;
                Mining.smDataSet.add(new StrongMiningData(edgeRank, ver2Rank));
            }
            // now the week
            if (e.label <= wmaxEdgeLabel) {
                if (Mining.wmDataSet[e.label] == null) {
                    Mining.wmDataSet[e.label] = new WeekMiningData(g);
                } else {
                    Mining.wmDataSet[e.label].addGraph(g);
                }
            }
        }
        if (hasNoCandidates) {
            it.remove();
        } else {
            g.init();
        }
    }
    md2Freq = null;
    Debugger.finishTask("rebuildGraphSet");
}

[Buggy Hunk]
Mining.wmDataSet = new Mining.WeekMiningData[wmaxEdgeLabel];

[Patch]
Mining.wmDataSet = new Mining.WeekMiningData[wmaxEdgeLabel+1];