[Demonstration 1]

[Buggy Method]
@SuppressWarnings({ "rawtypes" })
public void open(Map arg0, TopologyContext arg1, SpoutOutputCollector arg2) {
    collector = arg2;
    Object temp = arg0.get("log.statistics");
    this.keepStats = temp != null ? (Boolean) temp : false;
    temp = arg0.get("log.statistics.path");
    this.statsPath = temp != null ? (String) temp : "";
    temp = arg0.get("batchsize");
    this.batchSize = temp != null ? (Integer) temp : 1;
    id = arg1.getThisComponentId() + "." + arg1.getThisTaskIndex();
    if (keepStats) {
        countStat = new CountStat("", statsPath + File.separator + arg0.get(Config.TOPOLOGY_NAME) + "_" + id + ".rate.csv", false);
        countStat.start();
        costStat = new AvgStat("", statsPath + File.separator + arg0.get(Config.TOPOLOGY_NAME) + "_" + id + ".cost.csv", false);
        costStat.start();
    }
    udf.prepare(arg0, arg1);
}

[Buggy Hunk]
this.batchSize = temp != null ? (Integer) temp : 1;

[Patch]
this.batchSize = temp != null ? (Long) temp : 1;

[Demonstration 2]

[Buggy Method]
@Override
public void serialize(DateMidnight value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException {
    if (_useTimestamp(provider)) {
        // same as with other date-only values
        jgen.writeStartArray();
        jgen.writeNumber(value.year().get());
        jgen.writeNumber(value.monthOfYear().get());
        jgen.writeNumber(value.dayOfMonth().get());
        jgen.writeEndArray();
    } else {
        jgen.writeString(_format.createFormatter(provider).print(value));
    }
}

[Buggy Hunk]
jgen.writeString(_format.createFormatter(provider).print(value));

[Patch]
jgen.writeString(_format.createFormatterWithLocale(provider).print(value));