ONAP-REST DAO Sonar/Checkstyle clean and knock-on
[policy/engine.git] / ONAP-PAP-REST / src / main / java / org / onap / policy / pap / xacml / rest / components / NotifyOtherPaps.java
index b703917..c3171de 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP-PAP-REST
  * ================================================================================
  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -60,7 +61,7 @@ public class NotifyOtherPaps {
                 + entityType + "," + newGroupId + ") called");
         failedPaps = new ArrayList<>();
 
-        List<?> otherServers = PolicyDBDao.getPolicyDBDaoInstance().getOtherServers();
+        List<?> otherServers = PolicyDbDao.getPolicyDbDaoInstance().getOtherServers();
         // Notify other paps
         startNotifyThreads(otherServers, entityId, entityType, newGroupId);
         // Retry for failed paps
@@ -104,10 +105,9 @@ public class NotifyOtherPaps {
 
         @Override
         public void run() {
-            PolicyDBDao dao = new PolicyDBDao();
+            PolicyDbDao dao = new PolicyDbDao();
             PolicyDBDaoEntity dbdEntity = (PolicyDBDaoEntity) obj;
             String otherPap = dbdEntity.getPolicyDBDaoUrl();
-            String username = dbdEntity.getUsername();
             String txt;
             try {
                 txt = PeCryptoUtils.decrypt(dbdEntity.getPassword());
@@ -118,7 +118,6 @@ public class NotifyOtherPaps {
             }
 
             HttpURLConnection connection = null;
-            UUID requestId = UUID.randomUUID();
             URL url;
             String papUrl;
             try {
@@ -176,6 +175,10 @@ public class NotifyOtherPaps {
                 LOGGER.warn("Caught ProtocolException on connection.setRequestMethod(\"PUT\");", e);
                 return;
             }
+
+            String username = dbdEntity.getUsername();
+            UUID requestId = UUID.randomUUID();
+
             Base64.Encoder encoder = Base64.getEncoder();
             String encoding = encoder.encodeToString((username + ":" + txt).getBytes(StandardCharsets.UTF_8));
             connection.setRequestProperty("Authorization", "Basic " + encoding);