diff --git a/src/main/java/org/gcube/vomanagement/usermanagement/impl/LiferayGroupManager.java b/src/main/java/org/gcube/vomanagement/usermanagement/impl/LiferayGroupManager.java index 0857897..b77d6ca 100644 --- a/src/main/java/org/gcube/vomanagement/usermanagement/impl/LiferayGroupManager.java +++ b/src/main/java/org/gcube/vomanagement/usermanagement/impl/LiferayGroupManager.java @@ -121,28 +121,31 @@ public class LiferayGroupManager implements GroupManager { public VirtualGroup getVirtualGroup(long actualGroupId) throws GroupRetrievalFault, VirtualGroupNotExistingException { VirtualGroup toReturn = new VirtualGroup(); try { - _log.debug("Setting Thread Permission"); long userId = LiferayUserManager.getAdmin().getUserId(); PrincipalThreadLocal.setName(userId); PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(UserLocalServiceUtil.getUser(userId)); PermissionThreadLocal.setPermissionChecker(permissionChecker); Group site = GroupLocalServiceUtil.getGroup(actualGroupId); + _log.debug("Set Thread Permission done, getVirtual Group of " + site.getName()); if (site.getExpandoBridge().getAttribute(CustomAttributeKeys.VIRTUAL_GROUP.getKeyName()) == null || site.getExpandoBridge().getAttribute(CustomAttributeKeys.VIRTUAL_GROUP.getKeyName()).equals("")) { String warningMessage = String.format("Attribute %s not initialized.", CustomAttributeKeys.VIRTUAL_GROUP.getKeyName()); _log.warn(warningMessage); throw new VirtualGroupNotExistingException(warningMessage); } else { String[] values = (String[]) site.getExpandoBridge().getAttribute(CustomAttributeKeys.VIRTUAL_GROUP.getKeyName()); - if (values != null) { + if (values != null && values.length > 0) { String[] splits = values[0].split("\\|"); toReturn.setName(splits[0]); toReturn.setDescription(splits[1]); + } else { + toReturn.setName("NoVirtualGroupAssigned"); + toReturn.setDescription("NoVirtualGroupDescription"); } } } catch (Exception e) { e.printStackTrace(); } - return null; + return toReturn; } /** * {@inheritDoc}