Fix blocker sonar issues in dmaap-kafka11aaf 85/78185/1
authorParshad Patel <pars.patel@samsung.com>
Mon, 11 Feb 2019 06:14:54 +0000 (15:14 +0900)
committerParshad Patel <pars.patel@samsung.com>
Mon, 11 Feb 2019 06:17:31 +0000 (15:17 +0900)
Fix "NullPointerException" issue
Fix always evaluate to "false" issue

Issue-ID: DMAAP-894
Change-Id: I2a9cf4cc94631bd8f0042ef3f4f10450adb0876f
Signed-off-by: Parshad Patel <pars.patel@samsung.com>
src/main/java/org/onap/dmaap/commonauth/kafka/base/authorization/Cadi3AAFProvider.java
src/main/java/org/onap/dmaap/kafkaAuthorize/KafkaCustomAuthorizer.java

index 5ee43e8..9cc45fe 100644 (file)
@@ -54,8 +54,6 @@ public class Cadi3AAFProvider implements AuthorizationProvider {
        private static AAFAuthn<?> aafAuthn;
        private static AbsAAFLur<AAFPermission> aafLur;
 
-       private static boolean props_ok = false;
-
        private static final Logger logger = LoggerFactory.getLogger(Cadi3AAFProvider.class);
 
        public Cadi3AAFProvider() {
@@ -85,11 +83,6 @@ public class Cadi3AAFProvider implements AuthorizationProvider {
                                logger.error("Unable to load " + CADI_PROPERTIES);
                                logger.error("Error", e);
                        }
-
-                       props_ok = true;
-                       if (props_ok == false) {
-                               return;
-                       }
                }
 
                if (aafAuthn == null) {
@@ -101,7 +94,6 @@ public class Cadi3AAFProvider implements AuthorizationProvider {
                                aafAuthn = null;
                                if (access != null)
                                        access.log(e, "Failed to initialize AAF");
-                               props_ok = false;
                        }
                }
 
index cb33e29..acafbdf 100644 (file)
@@ -94,7 +94,7 @@ public class KafkaCustomAuthorizer implements Authorizer {
                                logger.info("^Event Received for topic " + topicName + " , User " + fullName + " , action = " + action);
                        }
 
-                       if (fullName.equals("admin")) {
+                       if (null != fullName && fullName.equals("admin")) {
                                return true;
                        }