Bug 981593 - NullPointerException when rendering portlet in method UIPortlet.getSuitedTheme()
Summary: NullPointerException when rendering portlet in method UIPortlet.getSuitedTheme()
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: JBoss Enterprise Portal Platform 6
Classification: JBoss
Component: Portal
Version: 6.0.x
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: DR01
: 6.1.1
Assignee: Lucas Ponce
QA Contact:
URL:
Whiteboard: FixAvail
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-07-05 08:42 UTC by rmazur
Modified: 2015-05-11 22:31 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-12-20 12:20:31 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker GTNPORTAL-3156 0 Minor Resolved NullPointerException when rendering portlet in method UIPortlet.getSuitedTheme() 2014-02-06 16:17:47 UTC

Description rmazur 2013-07-05 08:42:18 UTC
Description of problem:

During rendering of portal page an NPE error occurred when the portlet uicomponent try to retrieve theme (UIPortlet.getSuitedTheme() method).

After investigation, it seems that the uicomponent tree is broken in this case and UIPortalApplication (null in this case) cannot be retrieve via the getAncestorOfType(UIPortalApplication.class) method.

If you look at the content of uicomponent tree (see the "Expected results" and "Actual results"), you will see that standard portal uicomponent(UIPageBody,UIPortal,UISiteBody,UIViewWS,UIWorkingWorkspace,UIPortalApplication) are not in the tree.

We reproduced the case in dev environment when there are concurrent navigation requests (click around around the nav menu without waiting for a response).
It seems to be a concurrency issue in the portal itself.
For the moment we fix the NPE in the UIPortlet.gtmpl (By retrieving the UIPortalApplication from the RequestContext instead of parsing the full uicomponent tree) but we don't fix the root cause and the possible side effects.


Version-Release number of selected component (if applicable):
GateIn 3.5.2.Final-redhat-4

How reproducible:
Not always. Mostly while testing within customer test environment where deployed portlets model is more significant in term of size and complexity. 


Steps to Reproduce:
Actually we tried but we can't reproduce it locally using JSF2.1 Quickstart portlet calling same portlet tree. This only happens when using "full" application which has a lot of other dependencies. 
1.  
2.
3.

Actual results:
16:33:10,614 INFO  [stdout] (http-localhost/127.0.0.1:8080-5) Looking for UIPortalApplication parent

16:33:10,614 INFO  [stdout] (http-localhost/127.0.0.1:8080-5) parent : null - id : queries

16:33:10,614 INFO  [stdout] (http-localhost/127.0.0.1:8080-5) parent : null - id : row1

16:33:10,614 INFO  [stdout] (http-localhost/127.0.0.1:8080-5) parent : pp_portal_Dashboard - id : pp_portal_Dashboard

16:33:10,614 INFO  [stdout] (http-localhost/127.0.0.1:8080-5) parent : pp_portal_Dashboard - id : 22572705



16:34:11,868 INFO  [stdout] (http-localhost/127.0.0.1:8080-5) Looking for UIPortalApplication parent

16:34:11,868 INFO  [stdout] (http-localhost/127.0.0.1:8080-5) parent : null - id : activities

16:34:11,868 INFO  [stdout] (http-localhost/127.0.0.1:8080-5) parent : null - id : row2

16:34:11,868 INFO  [stdout] (http-localhost/127.0.0.1:8080-5) parent : pp_portal_Dashboard - id : pp_portal_Dashboard

16:34:11,868 INFO  [stdout] (http-localhost/127.0.0.1:8080-5) parent : pp_portal_Dashboard - id : 22572705



16:34:28,807 INFO  [stdout] (http-localhost/127.0.0.1:8080-5) Looking for UIPortalApplication parent

16:34:28,807 INFO  [stdout] (http-localhost/127.0.0.1:8080-5) parent : null - id : news

16:34:28,807 INFO  [stdout] (http-localhost/127.0.0.1:8080-5) parent : null - id : row2

16:34:28,807 INFO  [stdout] (http-localhost/127.0.0.1:8080-5) parent : pp_portal_Dashboard - id : pp_portal_Dashboard

16:34:28,807 INFO  [stdout] (http-localhost/127.0.0.1:8080-5) parent : pp_portal_Dashboard - id : 22572705


Expected results:
16:32:56,597 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) Looking for UIPortalApplication parent

16:32:56,597 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) parent : null - id : tasks

16:32:56,597 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) parent : null - id : row1

16:32:56,597 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) parent : pp_portal_Dashboard - id : pp_portal_Dashboard

16:32:56,597 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) parent : pp_portal_Dashboard - id : 22572705

16:32:56,597 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) parent : UIPageBody - id : UIPageBody

16:32:56,597 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) parent : clearstream - id : UIPortal

16:32:56,597 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) parent : UISiteBody - id : UISiteBody

16:32:56,597 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) parent : null - id : 17689309

16:32:56,598 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) parent : UIComponentDecorator - id : UIViewWS

16:32:56,598 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) parent : UIWorkingWorkspace - id : UIWorkingWorkspace

16:32:56,598 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) parent : UIPortalApplication - id : UIPortalApplication

16:32:56,598 INFO  [stdout] (http-localhost/127.0.0.1:8080-3) parent found : UIPortalApplication - id : UIPortalApplication


Additional info:
We think this caused by uiPortal.getAncestorOfType(UIPortalApplication.class) from UIComponent class which can't get the parent.

We've got an actual proposed solution which is to use Util.getUIPortalApplication() instead to get the same thing (getSkin).
Here is below the code snippet used:
-----------------------
			String theme = null;
			
			try{
			theme = uicomponent.getSuitedTheme(null);
			} catch (RuntimeException e) {
				Map<String, String> themeMap = uicomponent.stringToThemeMap(uicomponent.getTheme());
				if (themeMap.containsKey(uiPortalApp.getSkin())) {
					theme = themeMap.get(uiPortalApp.getSkin());
				}
				else theme= uicomponent.DEFAULT_THEME.split(":")[1];
			} 
----------------------

While doing some searches, we found out Exo people have also used similar approach (refer to URL link below). 
http://lists.jboss.org/pipermail/gatein-commits/2010-November/005095.html

Within Server.log we've got:
Caused by: java.lang.NullPointerException
        at org.exoplatform.portal.webui.application.UIPortlet.getSuitedTheme(UIPortlet.java:270) [exo.portal.webui.portal-3.5.2.Final-redhat-4.jar:3.5.2.Final-redhat-4]
        at sun.reflect.GeneratedMethodAccessor1549.invoke(Unknown Source) [:1.7.0_06]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_06]
        at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_06]
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229) [groovy-all-1.7.6.jar:1.7.6]
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52) [groovy-all-1.7.6.jar:1.7.6]
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124) [groovy-all-1.7.6.jar:1.7.6]
        at UIPortlet.run(UIPortlet.gtmpl:96)    at org.exoplatform.groovyscript.GroovyScript.render(GroovyScript.java:99) [exo.portal.component.scripting-3.5.2.Final-redhat-4.jar:3.5.2.Final-redhat-4]

Comment 2 Jared MORGAN 2013-11-05 23:55:28 UTC
This probably doesn't need a release note, based on the fact it isn't a customer reported issue. If you think otherwise, please provide CCFR when you sent the issue to QE.

Comment 4 Thomas Heute 2013-11-20 09:52:49 UTC
https://issues.jboss.org/browse/GTNPORTAL-3156

Comment 6 Dominik Pospisil 2013-12-09 15:06:54 UTC
Hi Lucas, do you have more info about the issue as indicated above and/or reproducer for this issue? Thanks!

Comment 7 Lucas Ponce 2013-12-09 15:14:14 UTC
Hi Dominik, unfortunately not. I contacted with Regis and he told me this issue appears sporadically and in a not clear way to reproduce (very specific of customer environment).

I couldn't reproduce it in my local environment with info below.

Comment 8 Dominik Pospisil 2013-12-20 12:20:31 UTC
Closing as I could not reproduce it as well.


Note You need to log in before you can comment on or make changes to this bug.