Fórumok

Themedisplay null issue in Liferay 6.2

Anil KC, módosítva 10 év-val korábban

Themedisplay null issue in Liferay 6.2

Junior Member Bejegyzések: 35 Csatlakozás dátuma: 2012.12.21. Legújabb bejegyzések
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, módosítva 10 év-val korábban

RE: Themedisplay null issue in Liferay 6.2

Liferay Master Bejegyzések: 722 Csatlakozás dátuma: 2010.08.05. Legújabb bejegyzések
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, módosítva 10 év-val korábban

RE: Themedisplay null issue in Liferay 6.2 (Válasz)

Liferay Legend Bejegyzések: 1399 Csatlakozás dátuma: 2010.09.17. Legújabb bejegyzések
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, módosítva 9 év-val korábban

RE: Themedisplay null issue in Liferay 6.2

Regular Member Bejegyzések: 195 Csatlakozás dátuma: 2011.12.30. Legújabb bejegyzések
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, módosítva 9 év-val korábban

RE: Themedisplay null issue in Liferay 6.2

Liferay Legend Bejegyzések: 6403 Csatlakozás dátuma: 2008.09.23. Legújabb bejegyzések
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.