Program: 84487
Project: 84487
Buggy source:
/** 
 * Called by   {@link #doFilter(ServletRequest,ServletResponse,FilterChain)} on POST requests
 * @param httpRequest
 * @param httpResponse
 */
@Override protected void doPost(HttpServletRequest httpRequest,HttpServletResponse httpResponse) throws IOException, ServletException {
  String page=httpRequest.getParameter("String_Node_Str");
  Map<String,Object> referenceMap=new HashMap<String,Object>();
  if (INSTALL_METHOD.equals(page)) {
    wizardModel.installMethod=httpRequest.getParameter("String_Node_Str");
    if (InitializationWizardModel.INSTALL_METHOD_SIMPLE.equals(wizardModel.installMethod)) {
      page=SIMPLE_SETUP;
    }
 else {
      page=DATABASE_SETUP;
    }
    renderTemplate(page,referenceMap,httpResponse);
  }
 else   if (SIMPLE_SETUP.equals(page)) {
    if ("String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"))) {
      renderTemplate(INSTALL_METHOD,referenceMap,httpResponse);
      return;
    }
    wizardModel.databaseRootPassword=httpRequest.getParameter("String_Node_Str");
    checkForEmptyValue(wizardModel.databaseRootPassword,errors,"String_Node_Str");
    wizardModel.hasCurrentOpenmrsDatabase=false;
    wizardModel.createTables=true;
    wizardModel.createDatabasePassword=wizardModel.databaseRootPassword;
    wizardModel.addDemoData=false;
    wizardModel.hasCurrentDatabaseUser=false;
    wizardModel.createDatabaseUser=true;
    wizardModel.createUserPassword=wizardModel.databaseRootPassword;
    wizardModel.moduleWebAdmin=true;
    wizardModel.autoUpdateDatabase=false;
    wizardModel.adminUserPassword=InitializationWizardModel.ADMIN_DEFAULT_PASSWORD;
    if (errors.isEmpty()) {
      page=WIZARD_COMPLETE;
    }
    renderTemplate(page,referenceMap,httpResponse);
  }
 else   if (DATABASE_SETUP.equals(page)) {
    if ("String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"))) {
      renderTemplate(INSTALL_METHOD,referenceMap,httpResponse);
      return;
    }
    wizardModel.databaseConnection=httpRequest.getParameter("String_Node_Str");
    checkForEmptyValue(wizardModel.databaseConnection,errors,"String_Node_Str");
    wizardModel.databaseDriver=httpRequest.getParameter("String_Node_Str");
    checkForEmptyValue(wizardModel.databaseConnection,errors,"String_Node_Str");
    try {
      loadedDriverString=DatabaseUtil.loadDatabaseDriver(wizardModel.databaseConnection,wizardModel.databaseDriver);
      log.info("String_Node_Str" + loadedDriverString);
    }
 catch (    ClassNotFoundException e) {
      errors.add("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
      renderTemplate(page,referenceMap,httpResponse);
      return;
    }
    if ("String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"))) {
      wizardModel.databaseName=httpRequest.getParameter("String_Node_Str");
      checkForEmptyValue(wizardModel.databaseName,errors,"String_Node_Str");
      wizardModel.hasCurrentOpenmrsDatabase=true;
    }
 else {
      wizardModel.hasCurrentOpenmrsDatabase=false;
      wizardModel.createTables=true;
      wizardModel.databaseName=httpRequest.getParameter("String_Node_Str");
      checkForEmptyValue(wizardModel.databaseName,errors,"String_Node_Str");
      wizardModel.createDatabaseUsername=httpRequest.getParameter("String_Node_Str");
      checkForEmptyValue(wizardModel.createDatabaseUsername,errors,"String_Node_Str");
      wizardModel.createDatabasePassword=httpRequest.getParameter("String_Node_Str");
      checkForEmptyValue(wizardModel.createDatabasePassword,errors,"String_Node_Str");
    }
    if (errors.isEmpty()) {
      page=DATABASE_TABLES_AND_USER;
    }
    renderTemplate(page,referenceMap,httpResponse);
  }
 else   if (DATABASE_TABLES_AND_USER.equals(page)) {
    if ("String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"))) {
      renderTemplate(DATABASE_SETUP,referenceMap,httpResponse);
      return;
    }
    if (wizardModel.hasCurrentOpenmrsDatabase) {
      wizardModel.createTables="String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"));
    }
    wizardModel.addDemoData="String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"));
    if ("String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"))) {
      wizardModel.currentDatabaseUsername=httpRequest.getParameter("String_Node_Str");
      checkForEmptyValue(wizardModel.currentDatabaseUsername,errors,"String_Node_Str");
      wizardModel.currentDatabasePassword=httpRequest.getParameter("String_Node_Str");
      checkForEmptyValue(wizardModel.currentDatabasePassword,errors,"String_Node_Str");
      wizardModel.hasCurrentDatabaseUser=true;
      wizardModel.createDatabaseUser=false;
    }
 else {
      wizardModel.hasCurrentDatabaseUser=false;
      wizardModel.createDatabaseUser=true;
      wizardModel.createUserUsername=httpRequest.getParameter("String_Node_Str");
      checkForEmptyValue(wizardModel.createUserUsername,errors,"String_Node_Str");
      wizardModel.createUserPassword=httpRequest.getParameter("String_Node_Str");
      checkForEmptyValue(wizardModel.createUserPassword,errors,"String_Node_Str");
    }
    if (errors.isEmpty()) {
      page=OTHER_RUNTIME_PROPS;
    }
    renderTemplate(page,referenceMap,httpResponse);
  }
 else   if (OTHER_RUNTIME_PROPS.equals(page)) {
    if ("String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"))) {
      renderTemplate(DATABASE_TABLES_AND_USER,referenceMap,httpResponse);
      return;
    }
    wizardModel.moduleWebAdmin="String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"));
    wizardModel.autoUpdateDatabase="String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"));
    if (wizardModel.createTables) {
      page=ADMIN_USER_SETUP;
    }
 else {
      page=IMPLEMENTATION_ID_SETUP;
    }
    renderTemplate(page,referenceMap,httpResponse);
  }
 else   if (ADMIN_USER_SETUP.equals(page)) {
    if ("String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"))) {
      renderTemplate(OTHER_RUNTIME_PROPS,referenceMap,httpResponse);
      return;
    }
    wizardModel.adminUserPassword=httpRequest.getParameter("String_Node_Str");
    String adminUserConfirm=httpRequest.getParameter("String_Node_Str");
    if (!wizardModel.adminUserPassword.equals(adminUserConfirm)) {
      errors.add("String_Node_Str");
      renderTemplate(ADMIN_USER_SETUP,referenceMap,httpResponse);
      return;
    }
    if (wizardModel.adminUserPassword.equals("String_Node_Str")) {
      errors.add("String_Node_Str");
      renderTemplate(ADMIN_USER_SETUP,referenceMap,httpResponse);
      return;
    }
    try {
      OpenmrsUtil.validatePassword("String_Node_Str",wizardModel.adminUserPassword,"String_Node_Str");
    }
 catch (    PasswordException p) {
      errors.add("String_Node_Str");
      renderTemplate(ADMIN_USER_SETUP,referenceMap,httpResponse);
      return;
    }
    if (errors.isEmpty()) {
      page=IMPLEMENTATION_ID_SETUP;
    }
    renderTemplate(page,referenceMap,httpResponse);
  }
 else   if (IMPLEMENTATION_ID_SETUP.equals(page)) {
    if ("String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"))) {
      if (wizardModel.createTables)       renderTemplate(ADMIN_USER_SETUP,referenceMap,httpResponse);
 else       renderTemplate(OTHER_RUNTIME_PROPS,referenceMap,httpResponse);
      return;
    }
    wizardModel.implementationIdName=httpRequest.getParameter("String_Node_Str");
    wizardModel.implementationId=httpRequest.getParameter("String_Node_Str");
    wizardModel.implementationIdPassPhrase=httpRequest.getParameter("String_Node_Str");
    wizardModel.implementationIdDescription=httpRequest.getParameter("String_Node_Str");
    if (wizardModel.implementationId.indexOf('^') != -1 || wizardModel.implementationId.indexOf('|') != -1) {
      errors.add("String_Node_Str");
      renderTemplate(IMPLEMENTATION_ID_SETUP,referenceMap,httpResponse);
      return;
    }
    if (errors.isEmpty()) {
      page=WIZARD_COMPLETE;
    }
    renderTemplate(page,referenceMap,httpResponse);
  }
 else   if (WIZARD_COMPLETE.equals(page)) {
    if ("String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"))) {
      if (InitializationWizardModel.INSTALL_METHOD_SIMPLE.equals(wizardModel.installMethod)) {
        page=SIMPLE_SETUP;
      }
 else {
        page=IMPLEMENTATION_ID_SETUP;
      }
      renderTemplate(page,referenceMap,httpResponse);
      return;
    }
    initJob=new InitializationCompletion();
    wizardModel.tasksToExecute=new ArrayList<WizardTask>();
    if (!wizardModel.hasCurrentOpenmrsDatabase)     wizardModel.tasksToExecute.add(WizardTask.CREATE_SCHEMA);
    if (wizardModel.createDatabaseUser)     wizardModel.tasksToExecute.add(WizardTask.CREATE_DB_USER);
    if (wizardModel.createTables) {
      wizardModel.tasksToExecute.add(WizardTask.CREATE_TABLES);
      wizardModel.tasksToExecute.add(WizardTask.ADD_CORE_DATA);
    }
    if (wizardModel.addDemoData)     wizardModel.tasksToExecute.add(WizardTask.ADD_DEMO_DATA);
    wizardModel.tasksToExecute.add(WizardTask.UPDATE_TO_LATEST);
    referenceMap.put("String_Node_Str",wizardModel.tasksToExecute);
    initJob.start();
    renderTemplate(PROGRESS_VM,referenceMap,httpResponse);
  }
}

Fixed version (ground truth):
/** 
 * Called by   {@link #doFilter(ServletRequest,ServletResponse,FilterChain)} on POST requests
 * @param httpRequest
 * @param httpResponse
 */
@Override protected void doPost(HttpServletRequest httpRequest,HttpServletResponse httpResponse) throws IOException, ServletException {
  String page=httpRequest.getParameter("String_Node_Str");
  Map<String,Object> referenceMap=new HashMap<String,Object>();
  if (INSTALL_METHOD.equals(page)) {
    wizardModel.installMethod=httpRequest.getParameter("String_Node_Str");
    if (InitializationWizardModel.INSTALL_METHOD_SIMPLE.equals(wizardModel.installMethod)) {
      page=SIMPLE_SETUP;
    }
 else {
      page=DATABASE_SETUP;
    }
    renderTemplate(page,referenceMap,httpResponse);
  }
 else   if (SIMPLE_SETUP.equals(page)) {
    if ("String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"))) {
      renderTemplate(INSTALL_METHOD,referenceMap,httpResponse);
      return;
    }
    wizardModel.databaseRootPassword=httpRequest.getParameter("String_Node_Str");
    checkForEmptyValue(wizardModel.databaseRootPassword,errors,"String_Node_Str");
    wizardModel.hasCurrentOpenmrsDatabase=false;
    wizardModel.createTables=true;
    wizardModel.createDatabasePassword=wizardModel.databaseRootPassword;
    wizardModel.addDemoData=false;
    wizardModel.hasCurrentDatabaseUser=false;
    wizardModel.createDatabaseUser=true;
    wizardModel.createUserPassword=wizardModel.databaseRootPassword;
    wizardModel.moduleWebAdmin=true;
    wizardModel.autoUpdateDatabase=false;
    wizardModel.adminUserPassword=InitializationWizardModel.ADMIN_DEFAULT_PASSWORD;
    try {
      loadedDriverString=DatabaseUtil.loadDatabaseDriver(wizardModel.databaseConnection,wizardModel.databaseDriver);
    }
 catch (    ClassNotFoundException e) {
      errors.add("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
      renderTemplate(page,referenceMap,httpResponse);
      return;
    }
    if (errors.isEmpty()) {
      page=WIZARD_COMPLETE;
    }
    renderTemplate(page,referenceMap,httpResponse);
  }
 else   if (DATABASE_SETUP.equals(page)) {
    if ("String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"))) {
      renderTemplate(INSTALL_METHOD,referenceMap,httpResponse);
      return;
    }
    wizardModel.databaseConnection=httpRequest.getParameter("String_Node_Str");
    checkForEmptyValue(wizardModel.databaseConnection,errors,"String_Node_Str");
    wizardModel.databaseDriver=httpRequest.getParameter("String_Node_Str");
    checkForEmptyValue(wizardModel.databaseConnection,errors,"String_Node_Str");
    try {
      loadedDriverString=DatabaseUtil.loadDatabaseDriver(wizardModel.databaseConnection,wizardModel.databaseDriver);
      log.info("String_Node_Str" + loadedDriverString);
    }
 catch (    ClassNotFoundException e) {
      errors.add("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
      renderTemplate(page,referenceMap,httpResponse);
      return;
    }
    if ("String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"))) {
      wizardModel.databaseName=httpRequest.getParameter("String_Node_Str");
      checkForEmptyValue(wizardModel.databaseName,errors,"String_Node_Str");
      wizardModel.hasCurrentOpenmrsDatabase=true;
    }
 else {
      wizardModel.hasCurrentOpenmrsDatabase=false;
      wizardModel.createTables=true;
      wizardModel.databaseName=httpRequest.getParameter("String_Node_Str");
      checkForEmptyValue(wizardModel.databaseName,errors,"String_Node_Str");
      wizardModel.createDatabaseUsername=httpRequest.getParameter("String_Node_Str");
      checkForEmptyValue(wizardModel.createDatabaseUsername,errors,"String_Node_Str");
      wizardModel.createDatabasePassword=httpRequest.getParameter("String_Node_Str");
      checkForEmptyValue(wizardModel.createDatabasePassword,errors,"String_Node_Str");
    }
    if (errors.isEmpty()) {
      page=DATABASE_TABLES_AND_USER;
    }
    renderTemplate(page,referenceMap,httpResponse);
  }
 else   if (DATABASE_TABLES_AND_USER.equals(page)) {
    if ("String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"))) {
      renderTemplate(DATABASE_SETUP,referenceMap,httpResponse);
      return;
    }
    if (wizardModel.hasCurrentOpenmrsDatabase) {
      wizardModel.createTables="String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"));
    }
    wizardModel.addDemoData="String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"));
    if ("String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"))) {
      wizardModel.currentDatabaseUsername=httpRequest.getParameter("String_Node_Str");
      checkForEmptyValue(wizardModel.currentDatabaseUsername,errors,"String_Node_Str");
      wizardModel.currentDatabasePassword=httpRequest.getParameter("String_Node_Str");
      checkForEmptyValue(wizardModel.currentDatabasePassword,errors,"String_Node_Str");
      wizardModel.hasCurrentDatabaseUser=true;
      wizardModel.createDatabaseUser=false;
    }
 else {
      wizardModel.hasCurrentDatabaseUser=false;
      wizardModel.createDatabaseUser=true;
      wizardModel.createUserUsername=httpRequest.getParameter("String_Node_Str");
      checkForEmptyValue(wizardModel.createUserUsername,errors,"String_Node_Str");
      wizardModel.createUserPassword=httpRequest.getParameter("String_Node_Str");
      checkForEmptyValue(wizardModel.createUserPassword,errors,"String_Node_Str");
    }
    if (errors.isEmpty()) {
      page=OTHER_RUNTIME_PROPS;
    }
    renderTemplate(page,referenceMap,httpResponse);
  }
 else   if (OTHER_RUNTIME_PROPS.equals(page)) {
    if ("String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"))) {
      renderTemplate(DATABASE_TABLES_AND_USER,referenceMap,httpResponse);
      return;
    }
    wizardModel.moduleWebAdmin="String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"));
    wizardModel.autoUpdateDatabase="String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"));
    if (wizardModel.createTables) {
      page=ADMIN_USER_SETUP;
    }
 else {
      page=IMPLEMENTATION_ID_SETUP;
    }
    renderTemplate(page,referenceMap,httpResponse);
  }
 else   if (ADMIN_USER_SETUP.equals(page)) {
    if ("String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"))) {
      renderTemplate(OTHER_RUNTIME_PROPS,referenceMap,httpResponse);
      return;
    }
    wizardModel.adminUserPassword=httpRequest.getParameter("String_Node_Str");
    String adminUserConfirm=httpRequest.getParameter("String_Node_Str");
    if (!wizardModel.adminUserPassword.equals(adminUserConfirm)) {
      errors.add("String_Node_Str");
      renderTemplate(ADMIN_USER_SETUP,referenceMap,httpResponse);
      return;
    }
    if (wizardModel.adminUserPassword.equals("String_Node_Str")) {
      errors.add("String_Node_Str");
      renderTemplate(ADMIN_USER_SETUP,referenceMap,httpResponse);
      return;
    }
    try {
      OpenmrsUtil.validatePassword("String_Node_Str",wizardModel.adminUserPassword,"String_Node_Str");
    }
 catch (    PasswordException p) {
      errors.add("String_Node_Str");
      renderTemplate(ADMIN_USER_SETUP,referenceMap,httpResponse);
      return;
    }
    if (errors.isEmpty()) {
      page=IMPLEMENTATION_ID_SETUP;
    }
    renderTemplate(page,referenceMap,httpResponse);
  }
 else   if (IMPLEMENTATION_ID_SETUP.equals(page)) {
    if ("String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"))) {
      if (wizardModel.createTables)       renderTemplate(ADMIN_USER_SETUP,referenceMap,httpResponse);
 else       renderTemplate(OTHER_RUNTIME_PROPS,referenceMap,httpResponse);
      return;
    }
    wizardModel.implementationIdName=httpRequest.getParameter("String_Node_Str");
    wizardModel.implementationId=httpRequest.getParameter("String_Node_Str");
    wizardModel.implementationIdPassPhrase=httpRequest.getParameter("String_Node_Str");
    wizardModel.implementationIdDescription=httpRequest.getParameter("String_Node_Str");
    if (wizardModel.implementationId.indexOf('^') != -1 || wizardModel.implementationId.indexOf('|') != -1) {
      errors.add("String_Node_Str");
      renderTemplate(IMPLEMENTATION_ID_SETUP,referenceMap,httpResponse);
      return;
    }
    if (errors.isEmpty()) {
      page=WIZARD_COMPLETE;
    }
    renderTemplate(page,referenceMap,httpResponse);
  }
 else   if (WIZARD_COMPLETE.equals(page)) {
    if ("String_Node_Str".equals(httpRequest.getParameter("String_Node_Str"))) {
      if (InitializationWizardModel.INSTALL_METHOD_SIMPLE.equals(wizardModel.installMethod)) {
        page=SIMPLE_SETUP;
      }
 else {
        page=IMPLEMENTATION_ID_SETUP;
      }
      renderTemplate(page,referenceMap,httpResponse);
      return;
    }
    initJob=new InitializationCompletion();
    wizardModel.tasksToExecute=new ArrayList<WizardTask>();
    if (!wizardModel.hasCurrentOpenmrsDatabase)     wizardModel.tasksToExecute.add(WizardTask.CREATE_SCHEMA);
    if (wizardModel.createDatabaseUser)     wizardModel.tasksToExecute.add(WizardTask.CREATE_DB_USER);
    if (wizardModel.createTables) {
      wizardModel.tasksToExecute.add(WizardTask.CREATE_TABLES);
      wizardModel.tasksToExecute.add(WizardTask.ADD_CORE_DATA);
    }
    if (wizardModel.addDemoData)     wizardModel.tasksToExecute.add(WizardTask.ADD_DEMO_DATA);
    wizardModel.tasksToExecute.add(WizardTask.UPDATE_TO_LATEST);
    referenceMap.put("String_Node_Str",wizardModel.tasksToExecute);
    initJob.start();
    renderTemplate(PROGRESS_VM,referenceMap,httpResponse);
  }
}