gCube 4.2

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@141377 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2016-12-22 14:09:17 +00:00
parent ce7cfad579
commit f20954049c
1 changed files with 18 additions and 2 deletions

View File

@ -87,7 +87,8 @@ public class SessionUtil {
scope = pContext.getCurrentScope(httpServletRequest);
}
logger.debug("Scope: " + scope);
if (scope == null || scope.isEmpty()) {
String error = "Error retrieving scope: " + scope;
logger.error(error);
@ -118,6 +119,7 @@ public class SessionUtil {
}
userName = gCubeUser.getUsername();
logger.debug("UserName: " + userName);
if (userName == null || userName.isEmpty()) {
String error = "Error retrieving username in scope " + scope
@ -126,8 +128,22 @@ public class SessionUtil {
throw new StatAlgoImporterServiceException(error);
}
token = pContext.getCurrentUserToken(scope, httpServletRequest);
if (hasCurrUserId) {
try {
token = pContext.getCurrentUserToken(scope,
Long.valueOf(currUserId));
} catch (Exception e) {
String error = "Error retrieving token for: [userId= "
+ currUserId + ", scope: " + scope + "]";
logger.error(error, e);
throw new StatAlgoImporterServiceException(error);
}
} else {
token = pContext.getCurrentUserToken(scope, httpServletRequest);
}
logger.debug("Token: " + token);
if (token == null || token.isEmpty()) {
String error = "Error retrieving token for " + userName
+ " in " + scope + ": " + token;