Fórum

Themedisplay null issue in Liferay 6.2

Anil KC, modificado 10 Anos atrás.

Themedisplay null issue in Liferay 6.2

Junior Member Postagens: 35 Data de Entrada: 21/12/12 Postagens Recentes
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
Pankaj Kathiriya, modificado 10 Anos atrás.

RE: Themedisplay null issue in Liferay 6.2

Liferay Master Postagens: 722 Data de Entrada: 05/08/10 Postagens Recentes
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
James Falkner, modificado 10 Anos atrás.

RE: Themedisplay null issue in Liferay 6.2 (Resposta)

Liferay Legend Postagens: 1399 Data de Entrada: 17/09/10 Postagens Recentes
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).
Traolly Xiong, modificado 9 Anos atrás.

RE: Themedisplay null issue in Liferay 6.2

Regular Member Postagens: 195 Data de Entrada: 30/12/11 Postagens Recentes
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
Olaf Kock, modificado 9 Anos atrás.

RE: Themedisplay null issue in Liferay 6.2

Liferay Legend Postagens: 6403 Data de Entrada: 23/09/08 Postagens Recentes
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.