@Override
  protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    try {
      UploadException uploadException =
          (UploadException) actionRequest.getAttribute(WebKeys.UPLOAD_EXCEPTION);

      if (uploadException != null) {
        Throwable cause = uploadException.getCause();

        if (uploadException.isExceededFileSizeLimit()) {
          throw new FileSizeException(cause);
        }

        if (uploadException.isExceededLiferayFileItemSizeLimit()) {
          throw new LiferayFileItemException(cause);
        }

        if (uploadException.isExceededUploadRequestSizeLimit()) {
          throw new UploadRequestSizeException(cause);
        }

        throw new PortalException(cause);
      }

      updateFileEntry(actionRequest, actionResponse);
    } catch (IOException ioe) {
      throw new SystemException(ioe);
    } catch (PortalException pe) {

      // LPS-52675

      if (_log.isDebugEnabled()) {
        _log.debug(pe, pe);
      }

      handleUploadException(actionRequest, actionResponse);
    }
  }
  @Override
  protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    String cmd = ParamUtil.getString(actionRequest, Constants.CMD);

    MBMessage message = null;

    try {
      UploadException uploadException =
          (UploadException) actionRequest.getAttribute(WebKeys.UPLOAD_EXCEPTION);

      if (uploadException != null) {
        Throwable cause = uploadException.getCause();

        if (uploadException.isExceededFileSizeLimit()) {
          throw new FileSizeException(cause);
        }

        if (uploadException.isExceededLiferayFileItemSizeLimit()) {
          throw new LiferayFileItemException(cause);
        }

        if (uploadException.isExceededUploadRequestSizeLimit()) {
          throw new UploadRequestSizeException(cause);
        }

        throw new PortalException(cause);
      } else if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) {

        message = updateMessage(actionRequest, actionResponse);
      } else if (cmd.equals(Constants.ADD_ANSWER)) {
        addAnswer(actionRequest);
      } else if (cmd.equals(Constants.DELETE)) {
        deleteMessage(actionRequest);
      } else if (cmd.equals(Constants.DELETE_ANSWER)) {
        deleteAnswer(actionRequest);
      } else if (cmd.equals(Constants.LOCK)) {
        lockThreads(actionRequest);
      } else if (cmd.equals(Constants.SUBSCRIBE)) {
        subscribeMessage(actionRequest);
      } else if (cmd.equals(Constants.UNLOCK)) {
        unlockThreads(actionRequest);
      } else if (cmd.equals(Constants.UNSUBSCRIBE)) {
        unsubscribeMessage(actionRequest);
      }

      if (Validator.isNotNull(cmd)) {
        WindowState windowState = actionRequest.getWindowState();

        if (!windowState.equals(LiferayWindowState.POP_UP)) {
          String redirect = getRedirect(actionRequest, actionResponse, message);

          sendRedirect(actionRequest, actionResponse, redirect);
        } else {
          String redirect =
              PortalUtil.escapeRedirect(ParamUtil.getString(actionRequest, "redirect"));

          if (Validator.isNotNull(redirect)) {
            actionResponse.sendRedirect(redirect);
          }
        }
      }
    } catch (NoSuchMessageException | PrincipalException | RequiredMessageException e) {

      SessionErrors.add(actionRequest, e.getClass());

      actionResponse.setRenderParameter("mvcPath", "/message_boards/error.jsp");
    } catch (AntivirusScannerException
        | CaptchaConfigurationException
        | CaptchaMaxChallengesException
        | CaptchaTextException
        | DuplicateFileEntryException
        | FileExtensionException
        | FileNameException
        | FileSizeException
        | LiferayFileItemException
        | LockedThreadException
        | MessageBodyException
        | MessageSubjectException
        | SanitizerException
        | UploadRequestSizeException e) {

      if (e instanceof AntivirusScannerException) {
        SessionErrors.add(actionRequest, e.getClass(), e);
      } else {
        SessionErrors.add(actionRequest, e.getClass());
      }
    } catch (AssetCategoryException | AssetTagException e) {
      SessionErrors.add(actionRequest, e.getClass(), e);
    } catch (Exception e) {
      Throwable cause = e.getCause();

      if (cause instanceof SanitizerException) {
        SessionErrors.add(actionRequest, SanitizerException.class);
      } else {
        throw e;
      }
    }
  }