summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorParshad Patel <pars.patel@samsung.com>2019-08-07 16:00:20 +0900
committerParshad Patel <pars.patel@samsung.com>2019-08-07 19:31:21 +0900
commitfe2fd7021b7cb8a7c2767c1df2e3586b5041018f (patch)
treeea43935df9ecdd59fa217dc7bcc4746fd6a0210c
parent71cf9cbe286d92e38b517e3a5829ba833859c93f (diff)
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 <pars.patel@samsung.com>
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/onboarding/ueb/Helper.java3
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LoginExternalAuthServiceImpl.java5
2 files changed, 5 insertions, 3 deletions
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<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();
}
}
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);
}