MS Model Input Validation
[policy/engine.git] / POLICY-SDK-APP / src / main / java / org / onap / policy / controller / AutoPushController.java
index 96e1046..64928f3 100644 (file)
@@ -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);