diff options
author | burdziak <olaf.burdziakowski@nokia.com> | 2019-04-16 15:41:14 +0200 |
---|---|---|
committer | burdziak <olaf.burdziakowski@nokia.com> | 2019-04-16 15:41:14 +0200 |
commit | 9b22ffd01e80767f7ae0a9d7053eaa9183160de2 (patch) | |
tree | 05938d4c3a5a6af18c6b10a06ad036b235ccb514 /ecomp-sdk/epsdk-analytics/src/main | |
parent | 2c6c55376190b63c8bcb76ba876b0a54f9d4fcc5 (diff) |
Fix sonar issues (part) in Controller
Change-Id: I992e13c938b6d1c691614f4f5e5118066293b3e0
Issue-ID: PORTAL-523
Signed-off-by: burdziak <olaf.burdziakowski@nokia.com>
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main')
-rw-r--r-- | ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/Controller.java | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/Controller.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/Controller.java index 24f66092..b26beb7a 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/Controller.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/Controller.java @@ -37,10 +37,12 @@ */ package org.onap.portalsdk.analytics.controller; +import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import javax.servlet.ServletContext; +import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -51,7 +53,12 @@ import org.onap.portalsdk.analytics.util.AppConstants; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; public class Controller extends org.onap.portalsdk.analytics.RaptorObject { - + + private static final String CONTROLLER_INVALID_ACTION = + "[Controller.processRequest]Invalid raptor action ["; + private static final String CONTROLLER_INSTANTIATE_EXCEPTION = + "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "; + private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(Controller.class); public Controller() { @@ -70,11 +77,11 @@ public class Controller extends org.onap.portalsdk.analytics.RaptorObject { if (action == null) throw new RaptorRuntimeException("Action not found"); } catch (RaptorException e) { - logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey + logger.debug(EELFLoggerDelegate.debugLogger, (CONTROLLER_INVALID_ACTION + actionKey + "]. RaptorException: " + e.getMessage())); return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException( - "[Controller.processRequest]Invalid raptor action [" + actionKey + CONTROLLER_INVALID_ACTION + actionKey + "]. Exception: " + e.getMessage())); } @@ -94,34 +101,34 @@ public class Controller extends org.onap.portalsdk.analytics.RaptorObject { return (String) handlerMethod.invoke(handler, paramValues); } catch (ClassNotFoundException e) { - logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey + logger.debug(EELFLoggerDelegate.debugLogger, (CONTROLLER_INVALID_ACTION + actionKey + "]. ClassNotFoundException: " + e.getMessage())); return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException( - "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: " + CONTROLLER_INSTANTIATE_EXCEPTION + e.getMessage())); } catch (IllegalAccessException e) { - logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey + logger.debug(EELFLoggerDelegate.debugLogger, (CONTROLLER_INVALID_ACTION + actionKey + "]. IllegalAccessException: " + e.getMessage())); return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException( - "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: " + CONTROLLER_INSTANTIATE_EXCEPTION + e.getMessage())); }catch (InstantiationException e) { - logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey + logger.debug(EELFLoggerDelegate.debugLogger, (CONTROLLER_INVALID_ACTION + actionKey + "]. InstantiationException: " + e.getMessage())); return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException( - "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: " + CONTROLLER_INSTANTIATE_EXCEPTION + e.getMessage())); }catch (NoSuchMethodException e) { - logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey + logger.debug(EELFLoggerDelegate.debugLogger, (CONTROLLER_INVALID_ACTION + actionKey + "]. NoSuchMethodException: " + e.getMessage())); return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException( - "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: " + CONTROLLER_INSTANTIATE_EXCEPTION + e.getMessage())); }catch (InvocationTargetException e) { - logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey + logger.debug(EELFLoggerDelegate.debugLogger, (CONTROLLER_INVALID_ACTION + actionKey + "]. InvocationTargetException: " + e.getMessage())); return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException( - "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: " + CONTROLLER_INSTANTIATE_EXCEPTION + e.getMessage())); } } // processRequest @@ -134,7 +141,7 @@ public class Controller extends org.onap.portalsdk.analytics.RaptorObject { } // handleRequest public void handleRequest(String actionKey, HttpServletRequest request, - HttpServletResponse response, ServletContext servletContext) throws Exception { + HttpServletResponse response, ServletContext servletContext) throws IOException,ServletException { servletContext.getRequestDispatcher("/" + processRequest(actionKey, request)).forward( request, response); } // handleRequest |