fixed warning in finally instead of catch

This commit is contained in:
Alfredo Oliviero 2024-10-29 16:40:06 +01:00
parent 43631206b3
commit e64f88d768
2 changed files with 8 additions and 4 deletions

View File

@ -82,11 +82,13 @@ public class GCubeHookSiteRoleLocalService extends UserGroupRoleLocalServiceWrap
else
vreFolderManager.removeAdmin(theUserToPromoteOrDeclass);
_log.info("*VREFolder-Hook** add/remove role operation complete");
}
finally {
} catch (Exception e) {
_log.error("An error occurred (or the user was already Admin) when trying to update shub role of userId "+ userId + " to the groupId: " + groupId, e);
throw e;
} finally {
AccessTokenProvider.instance.set(previousUMAToken);
SecurityTokenProvider.instance.set(previousToken);
_log.warn("An error occurred (or the user was already Admin) when trying to update shub role of userId "+ userId + " to the groupId: " + groupId);
}
}
}

View File

@ -161,10 +161,12 @@ public class GCubeHookUserLocalService extends UserLocalServiceWrapper {
client.addUserToGroup(username2Add,vreFolderNameForsHub);
else
client.removeUserFromGroup(username2Add, vreFolderNameForsHub);
} catch (Exception e) {
_log.error("An error occurred (or the user was already member) when trying to remove or add the user "+ username2Add + " to the VRE context: " + context, e);
throw e;
} finally {
AccessTokenProvider.instance.set(previousUMAToken);
SecurityTokenProvider.instance.set(previousToken);
_log.warn("An error occurred (or the user was already member) when trying to remove or add the user "+ username2Add + " to the VRE context: " + context);
}
_log.info("*VREFolder-Hook** " + username2Add + " was added or removed succefully from this VRE Folder. Added? (if false was removed)" + add);
return true;