not throwing Liferay exception on public method fixed, catching them

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portal/portal-manager@128231 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2016-04-21 12:11:30 +00:00
parent 78c6497969
commit 75905b622d
1 changed files with 19 additions and 14 deletions

View File

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