summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ErrorTicketService.java
diff options
context:
space:
mode:
Diffstat (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ErrorTicketService.java')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ErrorTicketService.java58
1 files changed, 39 insertions, 19 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ErrorTicketService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ErrorTicketService.java
index 3471aebe..673b53c2 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ErrorTicketService.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ErrorTicketService.java
@@ -86,12 +86,19 @@ public class ErrorTicketService {
// log.error("working: " + propertyMap.get("auth.00"));
} catch (Exception e) {
- log.error("Error: something went wrong");
- throw new EaafException("Error: Parsing errorhandling actions failed");
+ log.error("Error: something went wrong", e);
+ throw new EaafException("Error: Parsing errorhandling actions failed", new Object[]{}, e);
}
}
}
+ /**
+ * creates error handling data.
+ * @param throwable error
+ * @param req http request
+ * @return eror handle Data
+ * @throws EaafException In case of an internal error
+ */
public HandleData createHandleData(Throwable throwable, HttpServletRequest req) throws EaafException {
HandleData data = new HandleData(throwable, req);
extractErrorCode(data);
@@ -138,25 +145,30 @@ public class ErrorTicketService {
data.actionType = ActionType.NOTICKET_REDIRECT;
data.generateRedirect();
- } else {// ActionType.NOTICKET_NOREDIRECT -> nothing to be done
+ } else { // ActionType.NOTICKET_NOREDIRECT -> nothing to be done
data.actionType = ActionType.NOTICKET_NOREDIRECT;
}
} else {
data.generateSupportTicket();
- throw new EaafException("internal.configuration.00", new Object[] {data.errorCode + "in on_error_action" +
- ".properties"});
+ throw new EaafException("internal.configuration.00",
+ new Object[]{data.errorCode + "in on_error_action" + ".properties"});
}
}
- public class HandleData {
+ static class HandleData {
private final HttpServletRequest req;
- @Getter private String supportTicket;
- @Getter private String redirectUrl;
- @Getter private final Throwable throwable;
- @Getter private String errorCode;
- @Getter private ActionType actionType;
+ @Getter
+ private String supportTicket;
+ @Getter
+ private String redirectUrl;
+ @Getter
+ private final Throwable throwable;
+ @Getter
+ private String errorCode;
+ @Getter
+ private ActionType actionType;
private HandleData(Throwable throwable, HttpServletRequest req) {
@@ -166,30 +178,35 @@ public class ErrorTicketService {
private void generateRedirect() {
redirectUrl = ServletUtils.getBaseUrl(req);
- redirectUrl += "/" + ProtocolFinalizationController.ENDPOINT_ERROR_REDIRECT
- + "?" + EaafConstants.PARAM_HTTP_ERROR_CODE + "=" +
- StringEscapeUtils.escapeHtml4(req.getParameter(EaafConstants.PARAM_HTTP_ERROR_CODE));;
+ redirectUrl +=
+ "/" + ProtocolFinalizationController.ENDPOINT_ERROR_REDIRECT + "?" + EaafConstants.PARAM_HTTP_ERROR_CODE + "="
+ + StringEscapeUtils.escapeHtml4(req.getParameter(EaafConstants.PARAM_HTTP_ERROR_CODE));
}
private void generateSupportTicket() {
- String randomCode = RandomStringUtils.randomAlphanumeric(4).toUpperCase() + '-' +
- RandomStringUtils.randomAlphanumeric(4).toUpperCase() + '-' +
- RandomStringUtils.randomAlphanumeric(4).toUpperCase();
+ String randomCode =
+ RandomStringUtils.randomAlphanumeric(4).toUpperCase() + '-' + RandomStringUtils.randomAlphanumeric(4)
+ .toUpperCase() + '-' + RandomStringUtils.randomAlphanumeric(4).toUpperCase();
supportTicket = randomCode;
}
+ /**
+ * Logs error to technical log.
+ */
public void log_error() {
if (supportTicket != null) {
- log.error(TICKET_LOG_MSG, supportTicket, errorCode, throwable.getMessage(),
- throwable);
+ log.error(TICKET_LOG_MSG, supportTicket, errorCode, throwable.getMessage(), throwable);
} else {
log.error(TECH_LOG_MSG, errorCode, throwable.getMessage(), throwable);
}
}
+ /**
+ * Logs info to technical log.
+ */
public void log_info() {
if (supportTicket != null) {
@@ -200,6 +217,9 @@ public class ErrorTicketService {
}
}
+ /**
+ * Logs warn to technical log.
+ */
public void log_warn() {
if (supportTicket != null) {