diff --git a/component/portal/src/main/java/io/meeds/portal/permlink/service/PermanentLinkServiceImpl.java b/component/portal/src/main/java/io/meeds/portal/permlink/service/PermanentLinkServiceImpl.java index 9f5c6b27c3..a15a2611d8 100644 --- a/component/portal/src/main/java/io/meeds/portal/permlink/service/PermanentLinkServiceImpl.java +++ b/component/portal/src/main/java/io/meeds/portal/permlink/service/PermanentLinkServiceImpl.java @@ -42,6 +42,8 @@ import org.exoplatform.commons.exception.ObjectNotFoundException; import org.exoplatform.container.PortalContainer; import org.exoplatform.container.RootContainer.PortalContainerPostCreateTask; +import org.exoplatform.services.log.ExoLogger; +import org.exoplatform.services.log.Log; import org.exoplatform.services.security.Identity; import io.meeds.portal.permlink.model.PermanentLinkObject; @@ -53,6 +55,9 @@ public class PermanentLinkServiceImpl implements PermanentLinkService, Startable { + private static final Log LOG = + ExoLogger.getLogger(PermanentLinkServiceImpl.class); + public static final Context PERMANEN_LINK_CONTEXT = Context.GLOBAL.id("PermanentLink"); public static final Scope PERMANENT_LINK_SCOPE = Scope.GLOBAL.id("PermanentLinkIds"); @@ -207,10 +212,21 @@ private String getById(String permanentLinkId) { private String getAndSetId(String permanentLink) { String permanentLinkId = generateHash(permanentLink); - settingService.set(PERMANEN_LINK_CONTEXT, - PERMANENT_LINK_IDS_SCOPE, - permanentLinkId, - SettingValue.create(permanentLink)); + try { + settingService.set(PERMANEN_LINK_CONTEXT, + PERMANENT_LINK_IDS_SCOPE, + permanentLinkId, + SettingValue.create(permanentLink)); + } catch (RuntimeException e) { + if (settingService.get(PERMANEN_LINK_CONTEXT, + PERMANENT_LINK_IDS_SCOPE, + permanentLinkId) + == null) { + throw e; + } else { + LOG.debug("Duplicated Permanent Link Id {} set. This may be due to parallel saving", permanentLinkId); + } + } return permanentLinkId; } diff --git a/webui/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java b/webui/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java index 96ed13f084..1a38263e61 100644 --- a/webui/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java +++ b/webui/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java @@ -1204,7 +1204,7 @@ private List getCurrentPortlets() { // Determine portlets visible on the page uiPortlets = new ArrayList<>(); UISharedLayout sharedLayout = uiWorkingWorkspace.findFirstComponentOfType(UISharedLayout.class); - if (sharedLayout.isShowSharedLayout(requestContext)) { + if (sharedLayout == null || sharedLayout.isShowSharedLayout(requestContext)) { uiWorkingWorkspace.findComponentOfType(uiPortlets, UIPortlet.class); } else { UIPage currentPage = getCurrentPage();