summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorParshad Patel <pars.patel@samsung.com>2019-08-07 16:00:20 +0900
committerManoop Talasila <talasila@research.att.com>2019-08-13 18:26:05 +0000
commit26ac84c98902652f9a443688d8c2c3fd3cc8ff0b (patch)
tree7d2b56ca19fc28f72e5572db6e648b870e048eb6
parent4c7829600ee0750d0f813177595e02290b9127bc (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> (cherry picked from commit fe2fd7021b7cb8a7c2767c1df2e3586b5041018f)
-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);
}