Program: 89010
Project: 89010
Buggy source:
/** 
 * LDAP authentication.
 * @return Result
 */
private static Result LdapAuthenticate(){
  Form<Login> form=form(Login.class).bindFromRequest();
  String matriculationNumber=form.field("String_Node_Str").value();
  String password=form.field("String_Node_Str").value();
  String rememberMe=form.field("String_Node_Str").value();
  matriculationNumber=matriculationNumber.trim().toLowerCase();
  LdapService ldap=LdapService.getInstance();
  try {
    ldap.connect(matriculationNumber,password);
  }
 catch (  LdapService.LdapConnectorException e) {
    flash("String_Node_Str",e.getMessage());
    Component.addToContext(Component.ContextIdent.loginForm,form);
    return badRequest(index.render());
  }
  Account account=Account.findByLoginName(matriculationNumber);
  AccountRole role=AccountRole.STUDENT;
  if (ldap.getRole() != null) {
    role=ldap.getRole();
  }
  boolean updateAccount=false;
  if (account == null) {
    account=Account.findByEmail(ldap.getEmail());
    if (account == null) {
      account=new Account();
      Logger.info("String_Node_Str" + matriculationNumber + "String_Node_Str");
      account.firstname=ldap.getFirstName();
      account.lastname=ldap.getLastName();
      account.loginname=matriculationNumber;
      account.email=ldap.getEmail();
      account.password="String_Node_Str";
      Random generator=new Random();
      account.avatar="String_Node_Str" + generator.nextInt(10);
      account.role=role;
      account.create();
    }
 else {
      updateAccount=true;
    }
  }
 else {
    updateAccount=true;
  }
  if (updateAccount) {
    account.firstname=ldap.getFirstName();
    account.lastname=ldap.getLastName();
    account.email=ldap.getEmail();
    account.role=role;
    account.update();
  }
  session().clear();
  session("String_Node_Str",account.id.toString());
  if (rememberMe != null) {
    session("String_Node_Str","String_Node_Str");
  }
  return redirect(controllers.routes.Application.index());
}

Fixed version (ground truth):
/** 
 * LDAP authentication.
 * @return Result
 */
private static Result LdapAuthenticate(){
  Form<Login> form=form(Login.class).bindFromRequest();
  String matriculationNumber=form.field("String_Node_Str").value();
  String password=form.field("String_Node_Str").value();
  String rememberMe=form.field("String_Node_Str").value();
  matriculationNumber=matriculationNumber.trim().toLowerCase();
  LdapService ldap=LdapService.getInstance();
  try {
    ldap.connect(matriculationNumber,password);
  }
 catch (  LdapService.LdapConnectorException e) {
    flash("String_Node_Str",e.getMessage());
    Component.addToContext(Component.ContextIdent.loginForm,form);
    return badRequest(index.render());
  }
  Account account=Account.findByLoginName(matriculationNumber);
  AccountRole role=AccountRole.STUDENT;
  if (ldap.getRole() != null) {
    role=ldap.getRole();
  }
  if (account == null) {
    account=new Account();
    Logger.info("String_Node_Str" + matriculationNumber + "String_Node_Str");
    account.firstname=ldap.getFirstName();
    account.lastname=ldap.getLastName();
    account.loginname=matriculationNumber;
    account.password="String_Node_Str";
    Random generator=new Random();
    account.avatar="String_Node_Str" + generator.nextInt(10);
    account.role=role;
    account.create();
  }
 else {
    account.firstname=ldap.getFirstName();
    account.lastname=ldap.getLastName();
    account.role=role;
    account.update();
  }
  session().clear();
  session("String_Node_Str",account.id.toString());
  if (rememberMe != null) {
    session("String_Node_Str","String_Node_Str");
  }
  return redirect(controllers.routes.Application.index());
}