From fe2fd7021b7cb8a7c2767c1df2e3586b5041018f Mon Sep 17 00:00:00 2001 From: Parshad Patel Date: Wed, 7 Aug 2019 16:00:20 +0900 Subject: Sonar fix in epsdk-core 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 --- .../src/main/java/org/onap/portalsdk/core/onboarding/ueb/Helper.java | 3 ++- .../onap/portalsdk/core/service/LoginExternalAuthServiceImpl.java | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'ecomp-sdk/epsdk-core/src/main/java') diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/onboarding/ueb/Helper.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/onboarding/ueb/Helper.java index 581edee8..ee7a7d7d 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/onboarding/ueb/Helper.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/onboarding/ueb/Helper.java @@ -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(); + return new LinkedList<>(); } LinkedList 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(); } } diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LoginExternalAuthServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LoginExternalAuthServiceImpl.java index c31ef75e..d0450966 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LoginExternalAuthServiceImpl.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LoginExternalAuthServiceImpl.java @@ -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); } -- cgit 1.2.3-korg