Fix sonar critical 35/68835/3
authorPamela Dragosh <pdragosh@research.att.com>
Tue, 25 Sep 2018 10:47:53 +0000 (06:47 -0400)
committerPamela Dragosh <pdragosh@research.att.com>
Tue, 25 Sep 2018 12:35:58 +0000 (12:35 +0000)
Sonar complains that the password is an actual password when
in fact we are doing exactly the fix they suggest.

I seem to not have access to resolve it as a false positive.
So it seems the better way to do this is rename this to
reflect that it is actually a property value.

Had to also address 120> due to new variable name size.

Issue-ID: POLICY-1135
Change-Id: I2e2a36ed8d7f5c95e912df4f6ed74983cee8a3dd
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java

index 5241bd2..4ab7b49 100644 (file)
@@ -76,8 +76,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
     public static final String VSERVER_PROV_STATUS = "vserver.prov-status";
 
     private static final String AAI_URL = "aai.url";
-    private static final String AAI_USERNAME = "aai.username";
-    private static final String AAI_PASSWD = "aai.password";
+    private static final String AAI_USERNAME_PROPERTY = "aai.username";
+    private static final String AAI_PASS_PROPERTY = "aai.password";
 
     private static final String QUERY_AAI_ERROR_MSG = "Exception from queryAai: ";
 
@@ -882,8 +882,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
         try {
             if (vserverName != null) {
                 String aaiHostUrl = PolicyEngine.manager.getEnvironmentProperty(AAI_URL);
-                String aaiUser = PolicyEngine.manager.getEnvironmentProperty(AAI_USERNAME);
-                String aaiPassword = PolicyEngine.manager.getEnvironmentProperty(AAI_PASSWD);
+                String aaiUser = PolicyEngine.manager.getEnvironmentProperty(AAI_USERNAME_PROPERTY);
+                String aaiPassword = PolicyEngine.manager.getEnvironmentProperty(AAI_PASS_PROPERTY);
                 String aaiGetQueryByVserver = "/aai/v11/nodes/vservers?vserver-name=";
                 String url = aaiHostUrl + aaiGetQueryByVserver;
                 logger.info("AAI Host URL by VServer: {}", url);
@@ -912,8 +912,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
         String vnfId = event.getAai().get(GENERIC_VNF_VNF_ID);
 
         String aaiHostUrl = PolicyEngine.manager.getEnvironmentProperty(AAI_URL);
-        String aaiUser = PolicyEngine.manager.getEnvironmentProperty(AAI_USERNAME);
-        String aaiPassword = PolicyEngine.manager.getEnvironmentProperty(AAI_PASSWD);
+        String aaiUser = PolicyEngine.manager.getEnvironmentProperty(AAI_USERNAME_PROPERTY);
+        String aaiPassword = PolicyEngine.manager.getEnvironmentProperty(AAI_PASS_PROPERTY);
 
         try {
             if (vnfName != null) {
@@ -978,8 +978,8 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
         }
 
         AaiNqResponse aaiNqResponse = new AaiManager(new RESTManager()).postQuery(getPeManagerEnvProperty(AAI_URL),
-                getPeManagerEnvProperty(AAI_USERNAME), getPeManagerEnvProperty(AAI_PASSWD), aaiNqRequest,
-                onset.getRequestId());
+                getPeManagerEnvProperty(AAI_USERNAME_PROPERTY), getPeManagerEnvProperty(AAI_PASS_PROPERTY), 
+                aaiNqRequest, onset.getRequestId());
 
         // Check AAI response
         if (aaiNqResponse == null) {