[Demonstration 1]

[Buggy Method]
private static void doTransactionRequest(final Transaction transaction, final String cookie, final ApiBean api) {
    MessageWrapper data = JSONParser.createMessageWrapper(false, 0, "Request");
    data.setCookie(cookie);
    data.setMethodType(MethodType.TRANSFER_MONEY);
    data.setData(api.getJsonConverter().toJson(transaction));
    System.out.printf("%s Forwarding transaction request.\n", PREFIX);
    api.getAuthenticationClient().putFormAsyncWith1Param("/services/authentication/transaction", "data", api.getJsonConverter().toJson(data), (httpStatusCode, httpContentType, transactionReplyJson) -> {
        if (httpStatusCode == HTTP_OK) {
            MessageWrapper messageWrapper = api.getJsonConverter().fromJson(JSONParser.removeEscapeCharacters(transactionReplyJson), MessageWrapper.class);
            if (!messageWrapper.isError()) {
                sendTransactionCallback((Transaction) messageWrapper.getData(), api);
            } else {
                sendErrorReply(messageWrapper, api);
            }
        } else {
            sendErrorReply(JSONParser.createMessageWrapper(true, 500, "An unknown error occurred.", "There was a problem with one of the HTTP requests"), api);
        }
    });
}

[Buggy Hunk]
data.setData(api.getJsonConverter().toJson(transaction));

[Patch]
data.setData(transaction);

[Demonstration 2]

[Buggy Method]
private Job configureSCJob(String graphDir, String template, String outDir, int numMapTasks, boolean useLocalMultiThread, int numThreads, int numCores, String affinity, String omp_opt, int tpc, int mem, int send_array_limit, int nbr_split_len, boolean rotation_pipeline, int numIteration) throws IOException {
    Configuration configuration = getConf();
    Job job = Job.getInstance(configuration, "subgraph counting");
    Configuration jobConfig = job.getConfiguration();
    Path jobOutDir = new Path(outDir);
    FileSystem fs = FileSystem.get(configuration);
    if (fs.exists(jobOutDir)) {
        fs.delete(jobOutDir, true);
    }
    FileInputFormat.setInputPaths(job, graphDir);
    FileOutputFormat.setOutputPath(job, jobOutDir);
    //job.setInputFormatClass(KeyValueTextInputFormat.class);
    //use harp multifile input format to have a better control on num of map tasks
    job.setInputFormatClass(MultiFileInputFormat.class);
    job.setJarByClass(SCDaalLauncher.class);
    job.setMapperClass(SCDaalCollectiveMapper.class);
    JobConf jobConf = (JobConf) job.getConfiguration();
    jobConf.set("mapreduce.framework.name", "map-collective");
    // mapreduce.map.collective.memory.mb
    // 125000
    jobConf.setInt("mapreduce.map.collective.memory.mb", mem);
    // mapreduce.map.collective.java.opts
    // -Xmx120000m -Xms120000m
    // int xmx = (mem - 5000) > (mem * 0.9)
    //     ? (mem - 5000) : (int) Math.ceil(mem * 0.5);
    int xmx = (int) Math.ceil((mem - 5000) * 0.1);
    int xmn = (int) Math.ceil(0.25 * xmx);
    jobConf.set("mapreduce.map.collective.java.opts", "-Xmx" + xmx + "m -Xms" + xmx + "m" + " -Xmn" + xmn + "m");
    jobConf.setNumMapTasks(numMapTasks);
    jobConf.setInt("mapreduce.job.max.split.locations", 10000);
    jobConf.setInt("mapreduce.task.timeout", 60000000);
    job.setNumReduceTasks(0);
    jobConfig.setInt(SCConstants.NUM_MAPPERS, numMapTasks);
    jobConfig.set(SCConstants.TEMPLATE_PATH, template);
    jobConfig.set(SCConstants.OUTPUT_PATH, outDir);
    jobConfig.setBoolean(SCConstants.USE_LOCAL_MULTITHREAD, useLocalMultiThread);
    jobConfig.setInt(SCConstants.NUM_THREADS_PER_NODE, numThreads);
    jobConfig.setInt(SCConstants.THREAD_NUM, numThreads);
    jobConfig.setInt(SCConstants.CORE_NUM, numCores);
    jobConfig.set(SCConstants.THD_AFFINITY, affinity);
    jobConfig.set(SCConstants.OMPSCHEDULE, omp_opt);
    jobConfig.setInt(SCConstants.TPC, tpc);
    jobConfig.setInt(SCConstants.SENDLIMIT, send_array_limit);
    jobConfig.setInt(SCConstants.NBRTASKLEN, nbr_split_len);
    jobConfig.setBoolean(SCConstants.ROTATION_PIPELINE, rotation_pipeline);
    jobConfig.setInt(SCConstants.NUM_ITERATION, numIteration);
    return job;
}

[Buggy Hunk]
int xmx = (int) Math.ceil((mem - 5000)*0.1);

[Patch]
int xmx = (int) Math.ceil((mem - 5000)*0.2);

[Demonstration 3]

[Buggy Method]
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if (playerIn.isSneaking()) {
        Block drinkblock = getBlock(stack.getItemDamage());
        IBlockState iblockstate = worldIn.getBlockState(pos);
        Block block = iblockstate.getBlock();
        if (!block.isReplaceable(worldIn, pos)) {
            pos = pos.offset(facing);
        }
        if (stack.stackSize != 0 && playerIn.canPlayerEdit(pos, facing, stack) && worldIn.canBlockBePlaced(drinkblock, pos, false, facing, (Entity) null, stack)) {
            int i = this.getMetadata(stack.getMetadata());
            IBlockState iblockstate1 = drinkblock.getStateForPlacement(worldIn, pos, facing, hitX, hitY, hitZ, i, playerIn, stack);
            if (placeBlockAt(stack, playerIn, worldIn, pos, facing, hitX, hitY, hitZ, iblockstate1)) {
                SoundType soundtype = worldIn.getBlockState(pos).getBlock().getSoundType(worldIn.getBlockState(pos), worldIn, pos, playerIn);
                worldIn.playSound(playerIn, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
                --stack.stackSize;
            }
            return EnumActionResult.SUCCESS;
        }
        return EnumActionResult.PASS;
    } else {
        RayTraceResult raytraceresult = this.rayTrace(worldIn, playerIn, true);
        if (raytraceresult == null) {
            return EnumActionResult.PASS;
        } else {
            if (raytraceresult.typeOfHit == RayTraceResult.Type.BLOCK) {
                BlockPos blockpos = raytraceresult.getBlockPos();
                if (!worldIn.isBlockModifiable(playerIn, blockpos) || !playerIn.canPlayerEdit(blockpos.offset(raytraceresult.sideHit), raytraceresult.sideHit, stack)) {
                    return EnumActionResult.PASS;
                }
                if (worldIn.getBlockState(blockpos).getMaterial() == Material.WATER) {
                    worldIn.playSound(playerIn, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.NEUTRAL, 1.0F, 1.0F);
                    this.turnCupIntoItem(stack, playerIn, new ItemStack(ItemLoader.cold_water, 1, stack.getItemDamage()));
                    return EnumActionResult.SUCCESS;
                }
            }
        }
        return EnumActionResult.PASS;
    }
}

[Buggy Hunk]
this.turnCupIntoItem(stack, playerIn, new ItemStack(ItemLoader.cold_water, 1, stack.getItemDamage()));

[Patch]
stack = this.turnCupIntoItem(stack, playerIn, new ItemStack(ItemLoader.cold_water, 1, stack.getItemDamage()));