HttpServletResponse res, String warnPage)
throws IOException {
//Page tobe redirected in the case of warning
String warnRedirect = warnPage == null ? "index.jsp" : warnPage;
CarbonUIMessage carbonMessage;
String key;
ResourceBundle resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE, req.getLocale());
if (e.getFaultMessage() == null) {
CarbonUIMessage.sendCarbonUIMessage(e.getMessage(), CarbonUIMessage.ERROR, req, e);
res.sendRedirect("../admin/error.jsp");
return;
}
ModuleMgtException moduleMgtException = ModuleManagementUtils.getModuleMgtException(e);
if (moduleMgtException == null) {
CarbonUIMessage.sendCarbonUIMessage(e.getMessage(), CarbonUIMessage.ERROR, req, e);
res.sendRedirect("../admin/error.jsp");
return;
}
if (moduleMgtException.getLevel() == ModuleManagementConstants.WARNING) {
key = moduleMgtException.getKey();
carbonMessage = new CarbonUIMessage(resourceBundle.getString(key), CarbonUIMessage.WARNING);
req.getSession().setAttribute(CarbonUIMessage.ID, carbonMessage);
res.sendRedirect(warnRedirect);
return;
} else if (moduleMgtException.getLevel() == ModuleManagementConstants.ERROR) {
key = moduleMgtException.getKey();
carbonMessage = new CarbonUIMessage(resourceBundle.getString(key), CarbonUIMessage.ERROR);
req.getSession().setAttribute(CarbonUIMessage.ID, carbonMessage);
res.sendRedirect("../admin/error.jsp");
return;
}
}