Foros de discusión

Themedisplay null issue in Liferay 6.2

Anil KC, modificado hace 10 años.

Themedisplay null issue in Liferay 6.2

Junior Member Mensajes: 35 Fecha de incorporación: 21/12/12 Mensajes recientes
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 hace 10 años.

RE: Themedisplay null issue in Liferay 6.2

Liferay Master Mensajes: 722 Fecha de incorporación: 5/08/10 Mensajes recientes
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 hace 10 años.

RE: Themedisplay null issue in Liferay 6.2 (Respuesta)

Liferay Legend Mensajes: 1399 Fecha de incorporación: 17/09/10 Mensajes recientes
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 hace 9 años.

RE: Themedisplay null issue in Liferay 6.2

Regular Member Mensajes: 195 Fecha de incorporación: 30/12/11 Mensajes recientes
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 hace 9 años.

RE: Themedisplay null issue in Liferay 6.2

Liferay Legend Mensajes: 6403 Fecha de incorporación: 23/09/08 Mensajes recientes
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.