Merge "OOF Policy Config File Creation Issue" v1.2.0
authorJorge Hernandez <jh1730@att.com>
Thu, 12 Apr 2018 16:04:49 +0000 (16:04 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 12 Apr 2018 16:04:49 +0000 (16:04 +0000)
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/OptimizationConfigPolicy.java

index 2a03482..18d588c 100644 (file)
@@ -88,10 +88,12 @@ public class OptimizationConfigPolicy extends Policy {
 
        //save configuration of the policy based on the policyname
        private void saveConfigurations(String policyName, String jsonBody) {
+               
+               if(policyName.endsWith(".xml")){
+                       policyName = policyName.replace(".xml", "");
+               }
+               
                try (PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName +".json");){
-                       if(policyName.endsWith(".xml")){
-                               policyName = policyName.replace(".xml", "");
-                       }
                        out.println(jsonBody);
                } catch (Exception e) {
                        LOGGER.error("Exception Occured While writing Configuration data"+e);