X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fcontroller%2FPolicyNotificationController.java;h=707bbac09781180d1294c56792bfdfc221906f98;hb=2cc2acb29f4d7f925bb922a99e672844f2948260;hp=f987f906d420671d7e8aad0456767f17c8c15c32;hpb=c0f433d00f9a2178075b0077cbffe803eb505f04;p=policy%2Fengine.git diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java index f987f906d..707bbac09 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PolicyNotificationController.java @@ -38,8 +38,9 @@ import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; import org.onap.policy.rest.dao.CommonClassDao; import org.onap.policy.rest.jpa.WatchPolicyNotificationTable; -import org.openecomp.portalsdk.core.controller.RestrictedBaseController; -import org.openecomp.portalsdk.core.web.support.UserUtils; +import org.onap.policy.utils.PolicyUtils; +import org.onap.portalsdk.core.controller.RestrictedBaseController; +import org.onap.portalsdk.core.web.support.UserUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -60,7 +61,7 @@ public class PolicyNotificationController extends RestrictedBaseController { @RequestMapping(value={"/watchPolicy"}, method={org.springframework.web.bind.annotation.RequestMethod.POST}) public ModelAndView watchPolicy(HttpServletRequest request, HttpServletResponse response) throws IOException{ - String path = ""; + StringBuilder path = new StringBuilder(); String responseValue = ""; try { String userId = UserUtils.getUserSession(request).getOrgUserId(); @@ -76,9 +77,9 @@ public class PolicyNotificationController extends RestrictedBaseController { for (int i = 0; i < arrayNode.size(); i++) { JsonNode individualElement = arrayNode.get(i); if(i == 0){ - path = path + individualElement.toString().replace("\"", "").trim(); + path.append(individualElement.toString().replace("\"", "").trim()); }else{ - path = path + File.separator + individualElement.toString().replace("\"", "").trim(); + path.append(File.separator + individualElement.toString().replace("\"", "").trim()); } } } @@ -124,7 +125,7 @@ public class PolicyNotificationController extends RestrictedBaseController { request.setCharacterEncoding("UTF-8"); logger.error("Error druing watchPolicy function " + e); PrintWriter out = response.getWriter(); - out.write(e.getMessage()); + out.write(PolicyUtils.CATCH_EXCEPTION); } return null; }