/**
   * Update User Profile information such as address, email, etc. for the given Trader Dispatch to
   * the Trade Account JSP for display If any in put is incorrect revert back to the account page w/
   * an appropriate message
   *
   * @param userID The User to upddate profile info
   * @param password The new User password
   * @param cpassword Confirm password
   * @param fullname The new User fullname info
   * @param address The new User address info
   * @param cc The new User credit card info
   * @param email The new User email info
   * @param ctx the servlet context
   * @param req the HttpRequest object
   * @param resp the HttpResponse object
   * @exception javax.servlet.ServletException If a servlet specific exception is encountered
   * @exception javax.io.IOException If an exception occurs while writing results back to the user
   */
  void doAccountUpdate(
      ServletContext ctx,
      HttpServletRequest req,
      HttpServletResponse resp,
      String userID,
      String password,
      String cpassword,
      String fullName,
      String address,
      String creditcard,
      String email)
      throws javax.servlet.ServletException, java.io.IOException {
    String results = "";

    // First verify input data
    boolean doUpdate = true;
    if (password.equals(cpassword) == false) {
      results = "Update profile error: passwords do not match";
      doUpdate = false;
    } else if (password.length() <= 0
        || fullName.length() <= 0
        || address.length() <= 0
        || creditcard.length() <= 0
        || email.length() <= 0) {
      results = "Update profile error: please fill in all profile information fields";
      doUpdate = false;
    }
    AccountProfileDataBean accountProfileData =
        new AccountProfileDataBean(userID, password, fullName, address, email, creditcard);
    try {
      if (doUpdate) {
        accountProfileData = tAction.updateAccountProfile(accountProfileData);
        results = "Account profile update successful";
      }

    } catch (java.lang.IllegalArgumentException e) { // this is a user error so I will
      // forward them to another page rather than throw a 500
      req.setAttribute(
          "results",
          results
              + "invalid argument, check userID is correct, and the database is populated"
              + userID);
      Log.error(
          e,
          "TradeServletAction.doAccount(...)",
          "illegal argument, information should be in exception string",
          "treating this as a user error and forwarding on to a new page");
    } catch (Exception e) {
      // log the exception with error page
      throw new ServletException(
          "TradeServletAction.doAccountUpdate(...)" + " exception user =" + userID, e);
    }
    doAccount(ctx, req, resp, userID, results);
  }