From 645d9c71b5f1c613399a89ed069cc03d6a596980 Mon Sep 17 00:00:00 2001 From: burdziak Date: Fri, 7 Jun 2019 14:18:09 +0200 Subject: Fix soner issues in ErrorHandler Change-Id: I4d1954b25dc171eb344ce1d6523742f5defc5f0d Issue-ID: PORTAL-523 Signed-off-by: burdziak --- .../portalsdk/analytics/controller/ErrorHandler.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'ecomp-sdk') diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ErrorHandler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ErrorHandler.java index 1a31e604..30ec7b15 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ErrorHandler.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ErrorHandler.java @@ -63,6 +63,9 @@ import com.fasterxml.jackson.databind.SerializationFeature; public class ErrorHandler extends org.onap.portalsdk.analytics.RaptorObject { private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ErrorHandler.class); + + private static final String EXCEPTION_FATAL_ERROR = "[EXCEPTION ENCOUNTERED IN RAPTOR] Fatal error ["; + private static final String C_ERROR_SQL = "c_error_sql"; public ErrorHandler() { } @@ -105,11 +108,11 @@ public class ErrorHandler extends org.onap.portalsdk.analytics.RaptorObject { return sessionLogStrBuf.toString(); } public String processFatalError(HttpServletRequest request, RaptorException e) { - logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage())+" "+ getSessionLog(request) + e.getMessage()),AlarmSeverityEnum.MAJOR); + logger.error(EELFLoggerDelegate.debugLogger, (EXCEPTION_FATAL_ERROR + e.getClass().getName() + "]: " + nvl(e.getMessage())+" "+ getSessionLog(request) + e.getMessage()),AlarmSeverityEnum.MAJOR); if (e instanceof ReportSQLException) { String errorSQL = ((ReportSQLException) e).getReportSQL(); if (nvl(errorSQL).length() > 0) - request.setAttribute("c_error_sql", errorSQL); + request.setAttribute(C_ERROR_SQL, errorSQL); } // if AppUtils.processErrorNotification(request, e); @@ -118,11 +121,11 @@ public class ErrorHandler extends org.onap.portalsdk.analytics.RaptorObject { } // processFatalError public String processFatalErrorJSON(HttpServletRequest request, RaptorException e) { - logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage())+" "+ getSessionLog(request) + e.getMessage()),AlarmSeverityEnum.MAJOR); + logger.error(EELFLoggerDelegate.debugLogger, (EXCEPTION_FATAL_ERROR + e.getClass().getName() + "]: " + nvl(e.getMessage())+" "+ getSessionLog(request) + e.getMessage()),AlarmSeverityEnum.MAJOR); if (e instanceof ReportSQLException) { String errorSQL = ((ReportSQLException) e).getReportSQL(); if (nvl(errorSQL).length() > 0) - request.setAttribute("c_error_sql", errorSQL); + request.setAttribute(C_ERROR_SQL, errorSQL); } // if request.setAttribute(AppConstants.RI_EXCEPTION, e); @@ -136,7 +139,7 @@ public class ErrorHandler extends org.onap.portalsdk.analytics.RaptorObject { try { jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(errorJSONRuntime); } catch (Exception ex) { - logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Fatal error [" + ex.getClass().getName() + "]: " + nvl(ex.getMessage())+" "+ getSessionLog(request) + ex.getMessage()),AlarmSeverityEnum.MAJOR); + logger.error(EELFLoggerDelegate.debugLogger, (EXCEPTION_FATAL_ERROR + ex.getClass().getName() + "]: " + nvl(ex.getMessage())+" "+ getSessionLog(request) + ex.getMessage()),AlarmSeverityEnum.MAJOR); ex.printStackTrace(); } @@ -150,11 +153,11 @@ public class ErrorHandler extends org.onap.portalsdk.analytics.RaptorObject { return result.toString(); } public String processFatalErrorWMenu(HttpServletRequest request, RaptorException e) { - logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage())+" "+ getSessionLog(request) + e.getMessage()),AlarmSeverityEnum.MAJOR); + logger.error(EELFLoggerDelegate.debugLogger, (EXCEPTION_FATAL_ERROR + e.getClass().getName() + "]: " + nvl(e.getMessage())+" "+ getSessionLog(request) + e.getMessage()),AlarmSeverityEnum.MAJOR); if (e instanceof ReportSQLException) { String errorSQL = ((ReportSQLException) e).getReportSQL(); if (nvl(errorSQL).length() > 0) - request.setAttribute("c_error_sql", errorSQL); + request.setAttribute(C_ERROR_SQL, errorSQL); } // if AppUtils.processErrorNotification(request, e); -- cgit 1.2.3-korg