[Demonstration 1]

[Buggy Method]
public static void main(String[] arg) {
    //        int size = Integer.parseInt(arg[0]);
    //        int n = Integer.parseInt(arg[1]);
    int n = 3;
    int size = 4;
    MyList1 myList = new MyList1(size);
    System.out.println(myList.duplicate(n).size());
}

[Buggy Hunk]
System.out.println(myList.duplicate(n).size());

[Patch]
System.out.println("duplicate size:"+myList.duplicate(n).size());

[Demonstration 2]

[Buggy Method]
@RequestMapping(value = { "/add" }, method = RequestMethod.POST)
public String addProfile(@RequestParam(value = "avatar") MultipartFile file, ModelMap model, HttpServletRequest request) {
    ProfileForm form = WebUtils.requestToBean(request, ProfileForm.class);
    if (!file.isEmpty()) {
        String fileName = Common.saveFile(request, file, Profile.class.getName());
        form.setAvatar(fileName);
    }
    // check
    if (!form.validate()) {
        model.addAttribute("form", form);
        return "profile_add";
    }
    Profile data = new Profile();
    WebUtils.copyBean(form, data);
    // write database
    com.lingo.profiles.dao.Profile profile = new com.lingo.profiles.dao.Profile();
    Result result = profile.add(data);
    if (// error
    result.getResult() != 1) {
        // .....
        LingoLogger.logger.info(String.format("controller level: add profile error,Result:%d, Message:%s", result.getResult(), result.getMessage()));
        model.addAttribute("message", result.getMessage());
        return "message";
    }
    return String.format("redirect:/+%s", data.getName());
}

[Buggy Hunk]
String fileName = Common.saveFile(request, file, Profile.class.getName());

[Patch]
String fileName = Common.saveFile(request, file, Profile.class.getName(), form.getName());

[Demonstration 3]

[Buggy Method]
public void removeMail() {
    Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
    String value = params.get("value");
    LOGGER.trace("Removing mail: " + value);
    for (MailaddressDto address : bean.getPerson().getAdditionalMails()) {
        if (value.equals(address.getValue())) {
            bean.getPerson().getAdditionalMails().remove(address);
            LOGGER.trace("Mail removed: " + value);
        }
    }
}

[Buggy Hunk]
String value = params.get("value");

[Patch]
String value = params.get(PARAM_VALUE);