Fix critical sonar for ONAP-PAP-REST
[policy/engine.git] / ONAP-PAP-REST / src / main / java / org / onap / policy / pap / xacml / rest / components / Policy.java
index 6d0a0c7..130b2e5 100644 (file)
@@ -115,9 +115,9 @@ public abstract class Policy {
        public static final String EMPTY_STRING = "";
        private static final String String = null;
 
-       public static String CONFIG_HOME = null;
-       public static String ACTION_HOME = null;
-       public static String CONFIG_URL = null;
+       protected static String CONFIG_HOME = null;
+       protected static String ACTION_HOME = null;
+       protected static String CONFIG_URL = null;
 
        protected Map<String, String> performer = new HashMap<>();
 
@@ -213,7 +213,7 @@ public abstract class Policy {
        protected static boolean isJSONValid(String data) {
                JsonReader jsonReader = null;
                try {
-                       new JSONObject(data);
+                       JSONObject j = new JSONObject(data);
                        InputStream stream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
                        jsonReader = Json.createReader(stream);
                        LOGGER.info("Json Value is: " + jsonReader.read().toString() );
@@ -276,8 +276,6 @@ public abstract class Policy {
                                fileName = policyType + "_" + "PM" + "_" +java.lang.String.format(policyFileName) + "." +version +".xml";
                        }else if(policyConfigType.equals("ClosedLoop_Fault")){
                                fileName = policyType + "_" + "Fault" + "_" +java.lang.String.format(policyFileName) +  "." + version + ".xml";
-                       }else if(policyConfigType.equals("ClosedLoop_Fault")){
-                               fileName = policyType + "_" + "Fault" + "_" +java.lang.String.format(policyFileName) +  "." + version + ".xml";
                        }else if(policyConfigType.equals("Micro Service")){
                                fileName = policyType + "_" + "MS" + "_" + java.lang.String.format(policyFileName) + "." + version + ".xml";
                        }
@@ -336,6 +334,7 @@ public abstract class Policy {
                try {
                        loadWebapps();
                } catch (Exception e) {
+                       LOGGER.debug(e);
                        return null;
                }
                return configHome;
@@ -345,6 +344,7 @@ public abstract class Policy {
                try {
                        loadWebapps();
                } catch (Exception e) {
+                       LOGGER.debug(e);
                        return null;
                }
                return actionHome;