[Demonstration 1]

[Buggy Method]
private UserAuthentication getOrCreateUser(App app, Authentication ldapAuth) throws IOException {
    if (ldapAuth == null) {
        return null;
    }
    UserAuthentication userAuth = null;
    User user = new User();
    InetOrgPerson profile = (InetOrgPerson) ldapAuth.getPrincipal();
    if (profile != null && profile.isEnabled() && profile.isAccountNonLocked() && profile.isAccountNonExpired()) {
        String ldapAccountId = profile.getUsername();
        String email = profile.getMail();
        String name = StringUtils.join(profile.getCn(), ", ");
        if (StringUtils.isBlank(email)) {
            logger.warn("Failed to create LDAP user '{}' with blank email.", ldapAccountId);
            return null;
        }
        user.setAppid(getAppid(app));
        user.setIdentifier(Config.LDAP_PREFIX.concat(ldapAccountId));
        user.setEmail(email);
        user = User.readUserForIdentifier(user);
        if (user == null) {
            //user is new
            user = new User();
            user.setActive(true);
            user.setAppid(getAppid(app));
            user.setEmail(StringUtils.isBlank(email) ? ldapAccountId + "@ldap.com" : email);
            user.setName(StringUtils.isBlank(name) ? "No Name" : name);
            user.setPassword(new UUID().toString());
            user.setIdentifier(Config.LDAP_PREFIX.concat(ldapAccountId));
            String id = user.create();
            if (id == null) {
                throw new AuthenticationServiceException("Authentication failed: cannot create new user.");
            }
        } else {
            boolean update = false;
            if (!StringUtils.isBlank(email) && !StringUtils.equals(user.getEmail(), email)) {
                user.setEmail(email);
                update = true;
            }
            if (update) {
                user.update();
            }
        }
        userAuth = new UserAuthentication(new AuthenticatedUserDetails(user));
    }
    return userAuth;
}

[Buggy Hunk]
logger.warn("Failed to create LDAP user '{}' with blank email.", ldapAccountId);

[Patch]
LOG.warn("Failed to create LDAP user '{}' with blank email.", ldapAccountId);

[Demonstration 2]

[Buggy Method]
public void redrawActionObjectSprites(Problem problem) {
    removeAllActionObjectSprites();
    getEdgeSet().stream().filter(e -> !spriteManager.hasSprite("sprite-" + e.getId())).forEach(this::addEdgeSprite);
    problem.getAllVehicles().stream().sorted(Comparator.comparing(DefaultActionObject::getName)).forEach(v -> addVehicleSprite(v, v.getLocation()));
    problem.getAllPackages().stream().sorted(Comparator.comparing(DefaultActionObject::getName)).forEach(p -> addPackageSprite(p, p.getLocation()));
}

[Buggy Hunk]
public void redrawActionObjectSprites(Problem problem) {

[Patch]
public synchronized void redrawActionObjectSprites(Problem problem) {

[Demonstration 3]

[Buggy Method]
public void sendMessageAndReceive(String messageToSend) {
    network.sendMessage(messageToSend);
    network.messageToStandardOutput(network.getLastMessageReceived());
    if (network.getLastMessageReceived().equals(Message.WIN.getText())) {
        this.endConnection();
    }
}

[Buggy Hunk]
network.messageToStandardOutput(network.getLastMessageReceived());

[Patch]
network.messageToStandardOutput(network.receiveMessage());