[Demonstration 1]

[Buggy Method]
private void goCharStats() {
    String heroName = MountKabru.getCurrentGame().getHero().getName();
    String heroClass = MountKabru.getCurrentGame().getHero().getHeroClassType();
    int heroLevel = MountKabru.getCurrentGame().getHero().getLevelOfHero();
    int heroExperience = MountKabru.getCurrentGame().getHero().getExperience();
    int heroToNextLvl = MountKabru.getCurrentGame().getHero().getXpToNextLevel();
    int heroStrength = MountKabru.getCurrentGame().getHero().getStrength();
    int heroMana = MountKabru.getCurrentGame().getHero().getMana();
    int heroCurrentHP = MountKabru.getCurrentGame().getHero().getCurrentHitPoints();
    int heroDefence = MountKabru.getCurrentGame().getHero().getDefense();
    int heroAttack = MountKabru.getCurrentGame().getHero().getAttack();
    int heroSpellAttack = MountKabru.getCurrentGame().getHero().getSpellAttack();
    int heroGold = MountKabru.getCurrentGame().getHero().getGold();
    String weaponSlot = MountKabru.getCurrentGame().getHero().getInventory().getWeaponSlot().getName();
    String armorSlot = MountKabru.getCurrentGame().getHero().getInventory().getArmorSlot().getName();
    String spellSlot = MountKabru.getCurrentGame().getHero().getInventory().getSpellSlot().getName();
    String healthPotion = MountKabru.getCurrentGame().getHero().getInventory().getHealthPotionSlot().getName();
    String manaPotion = MountKabru.getCurrentGame().getHero().getInventory().getManaPotionSlot().getName();
    this.console.println("\n" + "\n Hero Name:        " + heroName + "\n Class:            " + heroClass + "\n Level:            " + heroLevel + "\n Experience:       " + heroExperience + "\n XP to Level Up:   " + heroToNextLvl + "\n Strength:         " + heroStrength + "\n Mana:             " + heroMana + "\n Hitpoints:        " + heroCurrentHP + "\n Defence:          " + heroDefence + "\n Attack:           " + heroAttack + "\n Spell Atk         " + heroSpellAttack + "\n Gold:             " + heroGold + "\n" + "\n Weapon:           " + weaponSlot + "\n Armor:            " + armorSlot + "\n Spell:            " + spellSlot + "\n HP Potion:        " + healthPotion + "\n Mana Potion:      " + manaPotion);
}

[Buggy Hunk]
String heroName = MountKabru.getCurrentGame().getHero().getName();

[Patch]
String heroName = MountKabru.getCurrentGame().getHero().getHeroName();

[Demonstration 2]

[Buggy Method]
public void update(String xmlString) throws IOException, InterruptedException {
    try {
        NodeInfo updateXml = this.saxon.transform(xmlString, "preprocess-studies-xml.xsl", null);
        if (null != updateXml) {
            Document document = new StoredDocument(updateXml.getDocumentRoot(), new File(getPreferences().getString("bs.studies.persistence-location")));
            updateIndex(document);
        }
    } catch (SaxonException x) {
        throw new RuntimeException(x);
    }
}

[Buggy Hunk]
public void update(String xmlString) throws IOException, InterruptedException {

[Patch]
public synchronized void update(String xmlString) throws IOException, InterruptedException {

[Demonstration 3]

[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());