Program: 189413
Project: 189413
Buggy source:
/** 
 * This is the login page for a particular authentication method. The user will arrive from the loginList method above. There are two cases for this method either the method is Implicit or Explicit. In the Explicit case the user is presented with a login screen and when they provide a correct username/password pair they are logged in. In the Implicit case the user is redirected to authenticate via an external service.
 * @param methodName The spring bean name of the authentication method.
 */
public static void loginMethod(String methodName){
  flash.keep("String_Node_Str");
  notFoundIfNull(methodName);
  if (params.get("String_Node_Str") != null)   Application.index();
  AuthenticationMethod method=null;
  try {
    method=(AuthenticationMethod)Spring.getBean(methodName);
  }
 catch (  Throwable t) {
    notFound();
  }
  if (!method.isEnabled())   error("String_Node_Str" + methodName + "String_Node_Str");
  if (method instanceof AuthenticationMethod.Implicit) {
    AuthenticationMethod.Implicit implicitMethod=(AuthenticationMethod.Implicit)method;
    Map<String,Object> routeArgs=new HashMap<String,Object>();
    routeArgs.put("String_Node_Str",methodName);
    ActionDefinition routeDefinition=Router.reverse("String_Node_Str",routeArgs);
    routeDefinition.absolute();
    String returnURL=routeDefinition.url;
    String initiationRedirect=implicitMethod.startAuthentication(request,returnURL);
    if (initiationRedirect == null) {
      loginReturn(methodName);
    }
 else {
      redirect(initiationRedirect);
    }
  }
 else   if (method instanceof AuthenticationMethod.Explicit) {
    AuthenticationMethod.Explicit explicitMethod=(AuthenticationMethod.Explicit)method;
    if (params.get("String_Node_Str") != null) {
      String username=params.get("String_Node_Str");
      String password=params.get("String_Node_Str");
      AuthenticationResult result=explicitMethod.authenticate(username,password,request);
      if (AuthenticationResult.SUCCESSFULL == result && context.getPerson() != null) {
        Person person=context.getPerson();
        session.put("String_Node_Str",person.getId());
        session.put("String_Node_Str",person.getFirstName());
        session.put("String_Node_Str",person.getLastName());
        session.put("String_Node_Str",person.getDisplayName());
        if (flash.get("String_Node_Str") != null) {
          String url=flash.get("String_Node_Str");
          flash.remove("String_Node_Str");
          redirect(url);
        }
 else {
          redirect("String_Node_Str");
        }
      }
      validation.addError("String_Node_Str","String_Node_Str");
      render(method,username,password);
    }
    render(method);
  }
  error("String_Node_Str" + methodName + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * This is the login page for a particular authentication method. The user will arrive from the loginList method above. There are two cases for this method either the method is Implicit or Explicit. In the Explicit case the user is presented with a login screen and when they provide a correct username/password pair they are logged in. In the Implicit case the user is redirected to authenticate via an external service.
 * @param methodName The spring bean name of the authentication method.
 */
public static void loginMethod(String methodName){
  flash.keep("String_Node_Str");
  notFoundIfNull(methodName);
  if (params.get("String_Node_Str") != null)   Application.index();
  AuthenticationMethod method=null;
  try {
    method=(AuthenticationMethod)Spring.getBean(methodName);
  }
 catch (  Throwable t) {
    notFound();
  }
  if (!method.isEnabled())   error("String_Node_Str" + methodName + "String_Node_Str");
  if (method instanceof AuthenticationMethod.Implicit) {
    AuthenticationMethod.Implicit implicitMethod=(AuthenticationMethod.Implicit)method;
    Map<String,Object> routeArgs=new HashMap<String,Object>();
    routeArgs.put("String_Node_Str",methodName);
    ActionDefinition routeDefinition=Router.reverse("String_Node_Str",routeArgs);
    routeDefinition.absolute();
    String returnURL=routeDefinition.url;
    String initiationRedirect=implicitMethod.startAuthentication(request,returnURL);
    if (initiationRedirect == null) {
      loginReturn(methodName);
    }
 else {
      redirect(initiationRedirect);
    }
  }
 else   if (method instanceof AuthenticationMethod.Explicit) {
    AuthenticationMethod.Explicit explicitMethod=(AuthenticationMethod.Explicit)method;
    if (params.get("String_Node_Str") != null) {
      String username=params.get("String_Node_Str");
      String password=params.get("String_Node_Str");
      AuthenticationResult result=explicitMethod.authenticate(username,password,request);
      if (AuthenticationResult.SUCCESSFULL == result && context.getPerson() != null) {
        Person person=context.getPerson();
        session.put("String_Node_Str",person.getId());
        session.put("String_Node_Str",person.getFirstName());
        session.put("String_Node_Str",person.getLastName());
        session.put("String_Node_Str",person.getDisplayName());
        if (flash.get("String_Node_Str") != null) {
          String url=flash.get("String_Node_Str");
          flash.remove("String_Node_Str");
          if (url != null) {
            redirect(url);
          }
        }
        Application.index();
      }
      validation.addError("String_Node_Str","String_Node_Str");
      render(method,username,password);
    }
    render(method);
  }
  error("String_Node_Str" + methodName + "String_Node_Str");
}