Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Anil KC
Themedisplay null issue in Liferay 6.2
December 19, 2013 8:58 PM
Answer

Anil KC

Rank: Junior Member

Posts: 35

Join Date: December 20, 2012

Recent Posts

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.

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


Did liferay changed methods to retrieve themeDisplay or what?
Pankaj Kathiriya
RE: Themedisplay null issue in Liferay 6.2
December 19, 2013 10:07 PM
Answer

Pankaj Kathiriya

Rank: Liferay Master

Posts: 697

Join Date: August 4, 2010

Recent Posts

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
James Falkner
RE: Themedisplay null issue in Liferay 6.2
December 20, 2013 6:01 AM
Answer

James Falkner

Community Moderator

Rank: Liferay Legend

Posts: 1406

Join Date: September 17, 2010

Recent Posts

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
RE: Themedisplay null issue in Liferay 6.2
November 27, 2014 11:29 PM
Answer

Traolly Xiong

Rank: Regular Member

Posts: 161

Join Date: December 30, 2011

Recent Posts

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.
Olaf Kock
RE: Themedisplay null issue in Liferay 6.2
November 27, 2014 11:55 PM
Answer

Olaf Kock

LIFERAY STAFF

Rank: Liferay Legend

Posts: 3434

Join Date: September 23, 2008

Recent Posts

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.