Fix BRMSGW Sonar Issues
[policy/engine.git] / BRMSGateway / src / main / java / org / onap / policy / brmsInterface / BRMSHandler.java
index 305f64d..c0a9cd2 100644 (file)
@@ -91,11 +91,11 @@ public class BRMSHandler implements BackUpHandler{
                                        bRMSPush.removeRule(removedPolicy.getPolicyName());
                                        removed = true;
                                }catch(Exception e){
-                                       logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW+"Rertriving policy failed " + e.getMessage());
+                                       logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW+"Rertriving policy failed " + e.getMessage(), e);
                                }
                        }
                }
-               Boolean failureFlag = false;
+               Boolean failureFlag;
                int i = 0;
                do{
                        failureFlag = false;
@@ -106,10 +106,11 @@ public class BRMSHandler implements BackUpHandler{
                                        //Upon Notification failure 
                                        failureFlag = true;
                                        bRMSPush.rotateURLs();
+                                       logger.error("Failure during Push Operation " , e);
                                }
                        }
                        i++;
-               }while(failureFlag && i< bRMSPush.URLListSize());
+               }while(failureFlag && i< bRMSPush.urlListSize());
        }
        
        /*
@@ -117,6 +118,7 @@ public class BRMSHandler implements BackUpHandler{
         * (non-Javadoc)
         * @see org.onap.policy.utils.BackUpHandler#runOnNotification(org.onap.policy.api.PDPNotification)
         */
+       @Override
        public void runOnNotification(PDPNotification notification){
                if(notification.getNotificationType().equals(NotificationType.REMOVE)){
                        removedPolicies(notification.getRemovedPolicies());
@@ -124,7 +126,7 @@ public class BRMSHandler implements BackUpHandler{
                        logger.info("Updated Policies: \n");
                        ArrayList<PolicyConfig> brmsPolicies = addedPolicies(notification);
                        Boolean successFlag = false;
-                       for(int i=0; !successFlag && i< bRMSPush.URLListSize(); i++){
+                       for(int i=0; !successFlag && i< bRMSPush.urlListSize(); i++){
                                if(i!=0){
                                        for(PolicyConfig policyConfig: brmsPolicies){
                                                logger.info("Policy Retry with this Name notified: " + policyConfig.getPolicyName());
@@ -138,6 +140,7 @@ public class BRMSHandler implements BackUpHandler{
                                        //Upon Notification failure 
                                        successFlag = false;
                                        bRMSPush.rotateURLs();
+                                       logger.error("Failure during Push Operation " , e);
                                }
                        }
                }
@@ -171,7 +174,7 @@ public class BRMSHandler implements BackUpHandler{
                                                }
                                        }
                                }catch(Exception e){
-                                       logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW+"Rertriving policy failed " + e.getMessage());
+                                       logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW+"Rertriving policy failed " + e.getMessage(), e);
                                }
                        }
                }