From c5d97e8a9a6bea71f3be329a2e44bdbe5fe50882 Mon Sep 17 00:00:00 2001 From: Michael Mokry Date: Mon, 5 Feb 2018 09:48:59 -0600 Subject: MS Model Input Validation - Provides validation for MS policy input content body that matches the GUI validations when create/update MS policy from API - Added changes to satisfy review comments and updated copywright headers for modified and new files Change-Id: I02bfa639bffb48520badd0e4fa34eb36418547ae Issue-ID: POLICY-377 Signed-off-by: Michael Mokry --- .../onap/policy/controller/AutoPushController.java | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'POLICY-SDK-APP') diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java index 96e104656..64928f3f4 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Engine * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,6 +78,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; public class AutoPushController extends RestrictedBaseController{ private static final Logger logger = FlexLogger.getLogger(AutoPushController.class); + private static final String UTF8 = "UTF-8"; + @Autowired CommonClassDao commonClassDao; @@ -319,9 +321,9 @@ public class AutoPushController extends RestrictedBaseController{ updatedGroupObject.setPolicies(currentPoliciesInGroup); this.container.updateGroup(updatedGroupObject); - response.setCharacterEncoding("UTF-8"); + response.setCharacterEncoding(UTF8); response.setContentType("application / json"); - request.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding(UTF8); PrintWriter out = response.getWriter(); refreshGroups(); @@ -336,8 +338,8 @@ public class AutoPushController extends RestrictedBaseController{ } } catch (Exception e){ - response.setCharacterEncoding("UTF-8"); - request.setCharacterEncoding("UTF-8"); + response.setCharacterEncoding(UTF8); + request.setCharacterEncoding(UTF8); PrintWriter out = response.getWriter(); logger.error(e); out.write(PolicyUtils.CATCH_EXCEPTION); @@ -379,9 +381,9 @@ public class AutoPushController extends RestrictedBaseController{ this.container.updateGroup(updatedGroupObject); } - response.setCharacterEncoding("UTF-8"); + response.setCharacterEncoding(UTF8); response.setContentType("application / json"); - request.setCharacterEncoding("UTF-8"); + request.setCharacterEncoding(UTF8); PrintWriter out = response.getWriter(); refreshGroups(); @@ -393,8 +395,8 @@ public class AutoPushController extends RestrictedBaseController{ return null; } catch (Exception e){ - response.setCharacterEncoding("UTF-8"); - request.setCharacterEncoding("UTF-8"); + response.setCharacterEncoding(UTF8); + request.setCharacterEncoding(UTF8); PrintWriter out = response.getWriter(); logger.error(e); out.write(PolicyUtils.CATCH_EXCEPTION); -- cgit 1.2.3-korg