掲示板

Themedisplay null issue in Liferay 6.2

10年前 に Anil KC によって更新されました。

Themedisplay null issue in Liferay 6.2

Junior Member 投稿: 35 参加年月日: 12/12/21 最新の投稿
I was using themedisplay object for getting multiple attributes like user, userId, scopeGroupId in Liferay 6.1.2 CE. But now I have using Liferay EE 6.2.10 EE the same methods are not working. It returns null pointer exception.

public static long getScopeGroupId(ActionRequest actionRequest) {
		ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
		return themeDisplay.getScopeGroupId();
	}


Did liferay changed methods to retrieve themeDisplay or what?
thumbnail
10年前 に Pankaj Kathiriya によって更新されました。

RE: Themedisplay null issue in Liferay 6.2

Liferay Master 投稿: 722 参加年月日: 10/08/05 最新の投稿
Did liferay changed methods to retrieve themeDisplay or what?

No, its the same as previous versions.

Make sure your portlets are built with reference to 6.2 version.

Regards,
Pankaj
thumbnail
10年前 に James Falkner によって更新されました。

RE: Themedisplay null issue in Liferay 6.2 (回答)

Liferay Legend 投稿: 1399 参加年月日: 10/09/17 最新の投稿
Pankaj Kathiriya:
Did liferay changed methods to retrieve themeDisplay or what?

No, its the same as previous versions.

Make sure your portlets are built with reference to 6.2 version.

Regards,
Pankaj


Yeah, the value of the constant (which is inlined into the .class file when you compile) has changed in 6.2. See this thread for details. We are looking at how we can catch this kind of incompatibility in the future (or at least recognize it and document it).
9年前 に Traolly Xiong によって更新されました。

RE: Themedisplay null issue in Liferay 6.2

Regular Member 投稿: 195 参加年月日: 11/12/30 最新の投稿
I created my portlet from a fresh 6.2 SDK and deployed it to a 6.2 LR instance and this NPE is still being thrown when using the code snippet below.

ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
String userName = themeDisplay.getUser().getScreenName();


Error:

8:08:29,021 ERROR [http-bio-80-exec-55][render_portlet_jsp:132] null
java.lang.NullPointerException
at com.gsa.portal.portlet.controller.GSASearchController.homeGSASearch(GSASearchController.java:114)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:103)
at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:55)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)

Any other ideas anyone?

Thanks.
thumbnail
9年前 に Olaf Kock によって更新されました。

RE: Themedisplay null issue in Liferay 6.2

Liferay Legend 投稿: 6403 参加年月日: 08/09/23 最新の投稿
Crossreferencing my answer here. Please include links to other places where you ask the same question yourself. This makes it easier to find answers, in case somebody else finds this question later.