diff --git a/src/main/java/org/gcube/common/portal/PortalContext.java b/src/main/java/org/gcube/common/portal/PortalContext.java index d76978f..2217af8 100644 --- a/src/main/java/org/gcube/common/portal/PortalContext.java +++ b/src/main/java/org/gcube/common/portal/PortalContext.java @@ -42,7 +42,7 @@ public class PortalContext { private static final String DEFAULT_VO_NAME = "devsec"; private static final String DEFAULT_GATEWAY_NAME = "D4science Gateway"; private static final String DEFAULT_GATEWAY_EMAIL = "do-not-reply@d4science.org"; - + private static PortalContext singleton = new PortalContext(); private String infra; @@ -58,7 +58,7 @@ public class PortalContext { public synchronized static PortalContext getConfiguration() { return singleton == null ? new PortalContext() : singleton; } - + private void initialize() { Properties props = new Properties(); try { @@ -106,8 +106,8 @@ public class PortalContext { } /** * - * @deprecated use getConfiguration().getGatewayName() method - * read the portal instance name from a property file and returns it + * @deprecated use getConfiguration().getGatewayName() method + * read the portal instance name from a property file and returns it */ @Deprecated public static String getPortalInstanceName() { @@ -139,8 +139,8 @@ public class PortalContext { Long defaultCompanyId = PortalUtil.getDefaultCompanyId(); try { CompanyLocalServiceUtil.getCompany(defaultCompanyId); - - return PortalUtil.getPortalURL(CompanyLocalServiceUtil.getCompany(defaultCompanyId).getVirtualHostname(), 443, true); + + return PortalUtil.getPortalURL(CompanyLocalServiceUtil.getCompany(defaultCompanyId).getVirtualHostname(), 443, true); } catch (PortalException e) { e.printStackTrace(); } catch (SystemException e) { @@ -155,14 +155,19 @@ public class PortalContext { * @throws PortalException * @throws SystemException */ - public String getSiteLandingPagePath(final HttpServletRequest request) throws PortalException, SystemException { + public String getSiteLandingPagePath(final HttpServletRequest request) { String sitePath = StringPool.BLANK; - Group site = getSiteFromServletRequest(request); - if (site.getPrivateLayoutsPageCount() > 0) { - sitePath = getGroupFriendlyURL(request, site); - } else { - _log.debug(site.getName() + " site doesn't have any private page. Default landing page will be used"); - } + Group site; + try { + site = getSiteFromServletRequest(request); + if (site.getPrivateLayoutsPageCount() > 0) { + sitePath = getGroupFriendlyURL(request, site); + } else { + _log.debug(site.getName() + " site doesn't have any private page. Default landing page will be used"); + } + }catch (Exception e) { + e.printStackTrace(); + } return sitePath; } /** @@ -221,7 +226,7 @@ public class PortalContext { } return toReturn; } - + /** * read the infrastructure gateway name from a property file and returns it * @deprecated use getGatewayName(HttpServletRequest request)