Fix soner issues in ErrorHandler 75/89575/1
authorburdziak <olaf.burdziakowski@nokia.com>
Fri, 7 Jun 2019 12:18:09 +0000 (14:18 +0200)
committerburdziak <olaf.burdziakowski@nokia.com>
Fri, 7 Jun 2019 12:18:09 +0000 (14:18 +0200)
Change-Id: I4d1954b25dc171eb344ce1d6523742f5defc5f0d
Issue-ID: PORTAL-523
Signed-off-by: burdziak <olaf.burdziakowski@nokia.com>
ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ErrorHandler.java

index 1a31e60..30ec7b1 100644 (file)
@@ -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);