[Demonstration 1]

[Buggy Method]
@Override
protected void map(Writable key, Text value, Context context) throws IOException, InterruptedException {
    // check the validity of the input
    if (key.toString().length() == 0 || value.toString().length() == 0)
        return;
    // read the original content as cluster
    ICluster cluster = IOUtilities.parseClusterFromCGFString(value.toString());
    int bin = -1;
    // use the previous bin if available
    String clusterBin = cluster.getProperty(HadoopClusterProperties.MAJOR_PEAK_CLUSTER_BIN);
    if (clusterBin != null) {
        bin = new Integer(clusterBin);
        context.getCounter("Binning Procedure", "pre-existing bin").increment(1);
    }
    // use the spectrum to cluster bin
    if (bin < 0) {
        // get the bin mapping
        String spectrumToClusterBin = cluster.getProperty(HadoopClusterProperties.SPECTRUM_TO_CLUSTER_BIN);
        if (spectrumToClusterBin != null) {
            int spectrumBin = new Integer(spectrumToClusterBin);
            // use the mapped bin
            bin = context.getConfiguration().getInt(String.format("mapping_%d", spectrumBin), -1);
            if (bin >= 0) {
                cluster.setProperty(HadoopClusterProperties.MAJOR_PEAK_CLUSTER_BIN, String.valueOf(bin));
                context.getCounter("Binning Procedure", "updated-bin").increment(1);
            }
        }
    }
    // as a fall back bin use the original binner
    if (bin < 0) {
        // precursor m/z
        float precursorMz = cluster.getPrecursorMz();
        // bin according the precursor mz
        bin = binner.asBins(precursorMz)[0];
        cluster.setProperty(HadoopClusterProperties.MAJOR_PEAK_CLUSTER_BIN, String.valueOf(bin));
        context.getCounter("Binning Procedure", "re-mapped bin").increment(1);
    }
    BinMZKey binMZKey = new BinMZKey(bin, cluster.getPrecursorMz());
    keyOutputText.set(binMZKey.toString());
    valueOutputText.set(value.toString());
    context.write(keyOutputText, valueOutputText);
    //context.getCounter("Bin frequency counter", "peakBin_" + String.valueOf(bin)).increment(1);
}

[Buggy Hunk]
valueOutputText.set(value.toString());

[Patch]
valueOutputText.set(IOUtilities.convertClusterToCGFString(cluster));

[Demonstration 2]

[Buggy Method]
private PendingIntent getIntent(Context context) {
    Intent intent = new Intent(context, TimerReceiver.class);
    intent.putExtra(TimerReceiver.EXTRA_TIMER_ID, id);
    return PendingIntent.getBroadcast(context, 0, intent, 0);
}

[Buggy Hunk]
return PendingIntent.getBroadcast(context, 0, intent, 0);

[Patch]
return PendingIntent.getBroadcast(context, id, intent, PendingIntent.FLAG_UPDATE_CURRENT);