Fixed the Policy API issues and Bugfixes
[policy/engine.git] / PolicyEngineAPI / src / main / java / org / openecomp / policy / std / StdPolicyEngine.java
index 5b10f30..0732c3c 100644 (file)
@@ -82,7 +82,7 @@ import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
 import org.openecomp.policy.common.logging.flexlogger.Logger;
 import org.openecomp.policy.models.APIDictionaryResponse;
 import org.openecomp.policy.models.APIPolicyConfigResponse;
-import org.openecomp.policy.utils.AAFPolicyClient.Environment;
+import org.openecomp.policy.utils.AAFEnvironment;
 import org.openecomp.policy.utils.PolicyUtils;
 import org.openecomp.policy.xacml.api.XACMLErrorConstants;
 import org.springframework.core.io.FileSystemResource;
@@ -689,15 +689,13 @@ public class StdPolicyEngine {
                 LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while connecting to " + pdps.get(0), e);
                 exception = new HttpClientErrorException(HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage());
             }
-            finally{
-                if(result == null){
-                    Collections.rotate(pdps, -1);
-                    Collections.rotate(encoding, -1);
-                    pdpsCount++;
-                }else{
-                    break;
-                }
-            }
+            if(result == null){
+                       Collections.rotate(pdps, -1);
+                       Collections.rotate(encoding, -1);
+                       pdpsCount++;
+               }else{
+                       break;
+               }
         }
         if(exception != null && exception.getStatusCode()!=null){
             if(exception.getStatusCode().equals(HttpStatus.UNAUTHORIZED)){
@@ -902,13 +900,13 @@ public class StdPolicyEngine {
                                pass = clientKey.trim();
                        }
                        setClientEncoding();
-                       environment = prop.getProperty("ENVIRONMENT", Environment.DEVL.toString());
-                       if(environment.equalsIgnoreCase(Environment.TEST.toString())){
-                               environment = Environment.TEST.toString();
-                       }else if(environment.equalsIgnoreCase(Environment.PROD.toString())){
-                               environment = Environment.PROD.toString();
+                       environment = prop.getProperty("ENVIRONMENT", AAFEnvironment.DEVL.toString());
+                       if(environment.equalsIgnoreCase(AAFEnvironment.TEST.toString())){
+                               environment = AAFEnvironment.TEST.toString();
+                       }else if(environment.equalsIgnoreCase(AAFEnvironment.PROD.toString())){
+                               environment = AAFEnvironment.PROD.toString();
                        }else{
-                               environment = Environment.DEVL.toString();
+                               environment = AAFEnvironment.DEVL.toString();
                        }
                        // Initializing the values.
                        pdps = new ArrayList<>();