[Demonstration 1]

[Buggy Method]
@POST
@Path("/save")
@Consumes("application/x-www-form-urlencoded")
public Response saveOrUpdateProduct(@FormParam("id") String id, @FormParam("name") String name, @FormParam("price") String price, @FormParam("quantity") String quantity, @FormParam("unit") String unit) {
    Double quantityDouble = Utilities.parseDouble(quantity);
    Unit unitEnum = Unit.getEnum(unit);
    productService.save(Integer.parseInt(id), name, Double.parseDouble(price), quantityDouble, unitEnum);
    return Response.ok().header("Access-Control-Allow-Origin", "*").build();
}

[Buggy Hunk]
productService.save(Integer.parseInt(id), name , Double.parseDouble(price), quantityDouble, unitEnum);

[Patch]
productService.save(id, name , Double.parseDouble(price), quantityDouble, unitEnum);

[Demonstration 2]

[Buggy Method]
public static void main(String[] args) throws Exception {
    ForkerBuilder builder = new ForkerBuilder().effectiveUser(EffectiveUserFactory.getDefault().administrator()).io(IO.IO);
    if (SystemUtils.IS_OS_LINUX) {
        // The linux example tries to list the shadow password file
        builder.command("cat", "/etc/shadow");
    } else {
        throw new UnsupportedOperationException();
    }
    Process p = builder.start();
    String string = IOUtils.toString(p.getInputStream());
    System.out.println(string);
}

[Buggy Hunk]
EffectiveUserFactory.getDefault().administrator()).io(IO.IO);

[Patch]
EffectiveUserFactory.getDefault().administrator()).io(IO.IO).redirectErrorStream(true);

[Demonstration 3]

[Buggy Method]
private void clearData() {
    Log.i(TAG, "clearData()");
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Wipe Data");
    builder.setMessage("Are you sure you want to clear all data and start over?");
    builder.setCancelable(false).setPositiveButton("Yes", new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int id) {
            helper.dropAll();
            SharedPreferences.Editor prefs = getSharedPreferences("PREFERENCE", MODE_PRIVATE).edit();
            prefs.remove(Constants.TARGET_DAY);
            prefs.remove(Constants.TARGET_REPS);
            prefs.commit();
            data = new AppData();
            loadActivity();
            showNewTargetDialog();
        }
    }).setNegativeButton("No", new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();
        }
    });
    builder.create().show();
}

[Buggy Hunk]
SharedPreferences.Editor prefs = getSharedPreferences("PREFERENCE", MODE_PRIVATE).edit();

[Patch]
SharedPreferences.Editor prefs = getSharedPreferences(PREFERENCE, MODE_PRIVATE).edit();