[Demonstration 1]

[Buggy Method]
@Override
public XMLMessage handleMsg(EventMessage msg) {
    XMLMessage resp = null;
    Pageable pageable = new PageRequest(0, 10);
    Page<Topic> topics = topicRepository.findAll(pageable);
    if (topics.getSize() > 0) {
        // 创建图文消息,提示用户图片对应的标签?
        ArrayList<XMLNewsMessage.Article> articles = new ArrayList<>();
        HashMap<String, String> cacheValue = new HashMap<>();
        for (int i = 0; i < topics.getSize(); i++) {
            Topic topic = topics.getContent().get(i);
            XMLNewsMessage.Article a = new XMLNewsMessage.Article();
            a.setTitle(topic.getTopicName());
            a.setDescription("回复" + (i + 1) + ": " + topic.getDescription());
            a.setPicurl(topic.getCoverImageUrl());
            a.setUrl(topic.getDetailUrl());
            articles.add(a);
            cacheValue.put(String.valueOf(i), topic.getTopicId());
        }
        resp = new XMLNewsMessage(msg.getFromUserName(), msg.getToUserName(), articles);
        String key = cacheService.getTopicKey(msg.getFromUserName());
        cacheService.put(key, cacheValue);
    }
    //回复
    return resp;
}

[Buggy Hunk]
for (int i = 0; i < topics.getSize(); i++) {

[Patch]
for (int i = 0; i < topics.getContent().size(); i++) {

[Demonstration 2]

[Buggy Method]
@Override
public void onItemDelete(int position, Subscription item) {
    RealmHelper.getInstance().delete(item);
}

[Buggy Hunk]
RealmHelper.getInstance().delete(item);

[Patch]
RealmHelper.getInstance().delete(mSubscriptionResults.get(position));

[Demonstration 3]

[Buggy Method]
@Override
public Document getNextPage(Document doc) throws IOException {
    if (doc.select("li.next.hidden").size() > 0) {
        // Last page
        throw new IOException("No more pages");
    }
    Elements els = doc.select("li.next > a");
    Element first = els.first();
    String nextURL = first.attr("href");
    nextURL = "http://www.hentai-foundry.com" + nextURL;
    return Http.url(nextURL).referrer(url).cookies(cookies).get();
}

[Buggy Hunk]
if (doc.select("li.next.hidden").size() > 0) {

[Patch]
if (doc.select("li.next.hidden").size() != 0) {