[Demonstration 1]

[Buggy Method]
@Override
protected Char chooseEnemy() {
    if (enemy == null || !enemy.isAlive() || state == WANDERING) {
        HashSet<Mob> enemies = new HashSet<Mob>();
        for (Mob mob : Dungeon.level.mobs) {
            if (mob.hostile && Level.fieldOfView[mob.pos] && mob.state != mob.PASSIVE) {
                enemies.add(mob);
            }
        }
        enemy = enemies.size() > 0 ? Random.element(enemies) : null;
    }
    return enemy;
}

[Buggy Hunk]
if (enemy == null || !enemy.isAlive() || state == WANDERING) {

[Patch]
if (enemy == null || !enemy.isAlive() || !Dungeon.level.mobs.contains(enemy) || state == WANDERING) {

[Demonstration 2]

[Buggy Method]
public List<JiraProject> getProjectsByClientPrefix(String clientPrefix) throws Exception {
    List<JiraProject> projects = new ArrayList<JiraProject>();
    for (BasicProject project : this.allBasicProjects) {
        if (clientPrefix.equals("BR") && project.getName().substring(0, 2).startsWith(clientPrefix) || project.getName().substring(2).startsWith(clientPrefix)) {
            String jql = new SearchBuilder(project.getKey(), null, null, null, null).build();
            SearchRestClient searchRestClient = this.restClient.getSearchClient();
            SearchResult results = searchRestClient.searchJql(jql, 10000, 0, null).claim();
            if (results.getTotal() > 0) {
                List<JiraIssue> jiraIssues = new ArrayList<JiraIssue>();
                List<Issue> issues = (List<Issue>) results.getIssues();
                Collections.sort(issues, new ComparatorIssue());
                for (Issue issue : issues) {
                    JiraIssue jiraIssue = getProjectFromIssueKeyBetweenDates(issue, null, null, "");
                    if (jiraIssue != null) {
                        jiraIssues.add(jiraIssue);
                    }
                }
                if (!jiraIssues.isEmpty()) {
                    JiraProject jiraProject = new JiraProject();
                    jiraProject.setAtividades(jiraIssues);
                    jiraProject.setProject(project.getName());
                    jiraProject.setId(project.getId());
                    jiraProject.setKey(project.getKey());
                    jiraProject.setDataCreate(jiraIssues.get(0).getCreated());
                    projects.add(jiraProject);
                }
            }
        }
    }
    return projects;
}

[Buggy Hunk]
for(BasicProject project : this.allBasicProjects) {

[Patch]
for(BasicProject project : this.restClient.getProjectClient().getAllProjects().get()) {

[Demonstration 3]

[Buggy Method]
@Post("form:txt")
public Representation shareFile(Representation entity) throws ResourceException {
    final Form form = new Form(entity);
    String shareWith = form.getFirstValue(PARAM_SHARE_USERS);
    String fileHash = (String) this.getRequestAttributes().get("hash");
    if (fileHash == null || fileHash.isEmpty()) {
        setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
        return new StringRepresentation("No file hash specified", MediaType.TEXT_PLAIN);
    }
    if (shareWith == null || shareWith.isEmpty()) {
        setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
        return new StringRepresentation("No users to share with specified", MediaType.TEXT_PLAIN);
    }
    // verify correct values are given
    String[] userIDsArray = shareWith.split(",");
    for (String userID : userIDsArray) {
        if (!UserManager.getInstance().checkUserExists(userID)) {
            setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
            return new StringRepresentation(String.format("User with id '%s' doesn't exists.", userID), MediaType.TEXT_PLAIN);
        }
    }
    List<String> userIDs = Arrays.asList();
    FileItem result = mFilesTable.get(fileHash);
    if (result != null) {
        if (FileManager.getInstance().shareFile(result, userIDs)) {
            return new StringRepresentation(String.format("Successfully sharing file '%s' with users '%s'", result.getName(), Arrays.toString(shareWith.split(","))), MediaType.TEXT_PLAIN);
        } else {
            String message = String.format("Problem during file '%s' sharing. Please check the logs!", result.getName());
            sLog.info(message);
            setStatus(Status.CLIENT_ERROR_FAILED_DEPENDENCY);
            return new StringRepresentation(message, MediaType.TEXT_PLAIN);
        }
    }
    String message = String.format("File with hash '%s' doesn't exists.", fileHash);
    sLog.info(message);
    setStatus(Status.CLIENT_ERROR_NOT_FOUND);
    return new StringRepresentation(message, MediaType.TEXT_PLAIN);
}

[Buggy Hunk]
List<String> userIDs = Arrays.asList();

[Patch]
List<String> userIDs = Arrays.asList(userIDsArray);