X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fcontroller%2FSafePolicyController.java;fp=ONAP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fcontroller%2FSafePolicyController.java;h=f994cbacb596c3299a8120b9620e437e489eb275;hb=7925630b5edc79119f29392edc6ddc84cf7c3757;hp=fad6a871f01d47cdec21608578e23399f9b01307;hpb=c53fa990ea27ec074859eb94bcb7ec6deaa2157b;p=policy%2Fengine.git diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/SafePolicyController.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/SafePolicyController.java index fad6a871f..f994cbacb 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/SafePolicyController.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/controller/SafePolicyController.java @@ -20,7 +20,9 @@ package org.onap.policy.pap.xacml.rest.controller; +import java.io.IOException; import java.io.PrintWriter; +import java.io.UnsupportedEncodingException; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -96,7 +98,7 @@ public class SafePolicyController { response.addHeader("operation", "getDictionary"); response.getWriter().write(j.toString()); } catch (Exception e) { - LOGGER.error(e.getMessage()); + LOGGER.error(e); response.setStatus(HttpServletResponse.SC_BAD_REQUEST); response.addHeader("error", "dictionaryDBQuery"); } @@ -105,7 +107,7 @@ public class SafePolicyController { @RequestMapping(value = { "/sp_dictionary/save_riskType" }, method = { org.springframework.web.bind.annotation.RequestMethod.POST }) public ModelAndView saveRiskTypeDictionary(HttpServletRequest request, HttpServletResponse response) - throws Exception { + throws UnsupportedEncodingException, IOException { try { boolean duplicateflag = false; boolean isFakeUpdate = false; @@ -189,6 +191,7 @@ public class SafePolicyController { return null; } }catch (Exception e) { + LOGGER.error(e); response.setCharacterEncoding("UTF-8"); request.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); @@ -200,7 +203,7 @@ public class SafePolicyController { @RequestMapping(value = { "/sp_dictionary/remove_riskType" }, method = { org.springframework.web.bind.annotation.RequestMethod.POST }) public ModelAndView removeOnapDictionary(HttpServletRequest request, HttpServletResponse response) - throws Exception { + throws UnsupportedEncodingException, IOException{ try { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -219,6 +222,7 @@ public class SafePolicyController { return null; } catch (Exception e) { + LOGGER.error(e); response.setCharacterEncoding("UTF-8"); request.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); @@ -257,16 +261,16 @@ public class SafePolicyController { response.addHeader("operation", "getDictionary"); response.getWriter().write(j.toString()); } catch (Exception e) { + LOGGER.error(e); response.setStatus(HttpServletResponse.SC_BAD_REQUEST); response.addHeader("error", "dictionaryDBQuery"); - LOGGER.error(e.getMessage()); } } @RequestMapping(value = { "/sp_dictionary/save_safePolicyWarning" }, method = { org.springframework.web.bind.annotation.RequestMethod.POST }) public ModelAndView saveSafePolicyWarningDictionary(HttpServletRequest request, HttpServletResponse response) - throws Exception { + throws UnsupportedEncodingException, IOException { try { boolean duplicateflag = false; boolean isFakeUpdate = false; @@ -342,6 +346,7 @@ public class SafePolicyController { } }catch (Exception e) { + LOGGER.error(e); response.setCharacterEncoding("UTF-8"); request.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); @@ -353,7 +358,7 @@ public class SafePolicyController { @RequestMapping(value = { "/sp_dictionary/remove_SafePolicyWarning" }, method = { org.springframework.web.bind.annotation.RequestMethod.POST }) public ModelAndView removeSafePolicyWarningDictionary(HttpServletRequest request, HttpServletResponse response) - throws Exception { + throws UnsupportedEncodingException, IOException { try { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);