[Demonstration 1]

[Buggy Method]
private int getMessageValue(String message) {
    String value = message.substring(message.indexOf(":"));
    value = value.trim();
    return Integer.parseInt(value);
}

[Buggy Hunk]
String value = message.substring(message.indexOf(":"));

[Patch]
String value = message.substring(message.indexOf(":")+1);

[Demonstration 2]

[Buggy Method]
static BetterLog buildLog(int priority, String tag, String message, Throwable tr) {
    sBuilder.priority(priority);
    sBuilder.tag(tag);
    message = ((message != null) ? message : "") + ((tr != null) ? '\n' + Log.getStackTraceString(tr) : "");
    sBuilder.message(message);
    sBuilder.flags(Config.defaultFlags);
    sBuilder.trace(new TraceLog(BLog.class, 2));
    sBuilder.threadName(Thread.currentThread().getName());
    sBuilder.clearSessions();
    String[] currentSessions = Session.getCurrentSessions();
    for (int i = 0; i < currentSessions.length; i++) {
        sBuilder.putSession(currentSessions[i]);
    }
    return sBuilder.build();
}

[Buggy Hunk]
String[] currentSessions = Session.getCurrentSessions();

[Patch]
SessionLog[] currentSessions = Session.getCurrentSessions();

[Demonstration 3]

[Buggy Method]
public static void main(String[] args) {
    TopologyBuilder builder = new TopologyBuilder();
    builder.setSpout(ConStant.LOFTER_SPOUT, SpoutFactory.buildSpout(ConStant.LOFTER_TOPIC, ConStant.LOFTER_SPOUT));
    builder.setBolt(ConStant.FETCH_BOLT, new FetchBolt()).shuffleGrouping(ConStant.LOFTER_SPOUT);
    builder.setBolt(ConStant.HIST_BOLT, new HistBolt()).shuffleGrouping(ConStant.FETCH_BOLT);
    builder.setBolt(ConStant.IMG_SIGN_BOLT, new ImageHashBolt()).shuffleGrouping(ConStant.HIST_BOLT);
    builder.setBolt(ConStant.OCR_BOLT, new OcrBolt(), 5).shuffleGrouping(ConStant.IMG_SIGN_BOLT);
    builder.setBolt(ConStant.SAR_BOLT, new SarBolt(), 2).shuffleGrouping(ConStant.OCR_BOLT);
    builder.setBolt(ConStant.SEN_BOLT, new SenBolt()).shuffleGrouping(ConStant.SAR_BOLT);
    builder.setBolt(ConStant.LOGGER_BOLT, new LoggerBolt()).shuffleGrouping(ConStant.SEN_BOLT);
    StormTopology topology = builder.createTopology();
    Config config = new Config();
    config.setDebug(true);
    config.put(Config.STORM_ZOOKEEPER_SERVERS, Arrays.asList(MatchpConfig.getSTORM_ZK_SERVER().split(",")));
    config.put(Config.STORM_ZOOKEEPER_PORT, MatchpConfig.getSTORM_ZK_PORT());
    if (args.length != 1) {
        logger.error(" need a parameter local model(0) or cluster model(1)");
        return;
    } else {
        int mode = Integer.parseInt(args[0]);
        logger.info("mode is {}", mode);
        switch(mode) {
            case 0:
                LocalCluster cluster = new LocalCluster();
                cluster.submitTopology("matchp", config, topology);
                break;
            case 1:
                try {
                    StormSubmitter.submitTopology("matchp", config, topology);
                } catch (AlreadyAliveException | InvalidTopologyException | AuthorizationException e) {
                    e.printStackTrace();
                    logger.error(e.getMessage());
                }
                break;
            default:
                logger.error("unknown mode {}", mode);
                return;
        }
    }
}

[Buggy Hunk]
builder.setBolt(ConStant.HIST_BOLT, new HistBolt()).shuffleGrouping(ConStant.FETCH_BOLT);

[Patch]
builder.setBolt(ConStant.HIST_BOLT, new HistBolt(),5).shuffleGrouping(ConStant.FETCH_BOLT);