Sonar fix in epsdk-core 68/92868/1
authorParshad Patel <pars.patel@samsung.com>
Wed, 7 Aug 2019 07:00:20 +0000 (16:00 +0900)
committerParshad Patel <pars.patel@samsung.com>
Wed, 7 Aug 2019 10:31:21 +0000 (19:31 +0900)
A "NullPointerException" could be thrown; "appuser" is nullable here
Either re-interrupt this method or rethrow the "InterruptedException"

Issue-ID: PORTAL-562
Change-Id: Idc3cf823d42ad4afc3ca1ae58c3994916e0d8142
Signed-off-by: Parshad Patel <pars.patel@samsung.com>
ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/onboarding/ueb/Helper.java
ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LoginExternalAuthServiceImpl.java

index 581edee..ee7a7d7 100644 (file)
@@ -62,7 +62,7 @@ public class Helper {
                String url = PortalApiProperties.getProperty(PortalApiConstants.UEB_URL_LIST);
                if (url == null) {
                        logger.error("uebUrlList: failed to get property " + PortalApiConstants.UEB_URL_LIST);
-                       return new LinkedList<String>();
+                       return new LinkedList<>();
                }
                LinkedList<String>              urlList = new LinkedList<>();
                for (String u : url.split(",")) {
@@ -76,6 +76,7 @@ public class Helper {
                        Thread.sleep(milliseconds);
                } catch (InterruptedException e) {
                        logger.warn("sleep was interrupted", e);
+                       Thread.currentThread().interrupt();
                }
        }
 
index c31ef75..d045096 100644 (file)
@@ -126,8 +126,9 @@ public class LoginExternalAuthServiceImpl implements LoginExternalAuthService {
                                if (appuser == null && userHasRoleFunctions(user)) {
                                        createUserIfNecessary(user);
                                } else {
-                                       appuser.setLastLoginDate(new Date());
-
+                    if (appuser != null) {
+                        appuser.setLastLoginDate(new Date());
+                    }
                                        // update the last logged in date for the user
                                        dataAccessService.saveDomainObject(appuser, additionalParams);
                                }