Details
-
Bug
-
Status: Closed
-
Top
-
Resolution: Fixed
-
2.28.11
-
None
Description
WebApplicationInvokingPipeline is supposed to work for both mount and sitemap item.
It works fine if you set the named pipeline in a sitemap item configuration, but it doesn't work for a mount.
In my project, I captured a stack trace:
[INFO] [talledLocalContainer] Caused by: java.lang.NullPointerException [INFO] [talledLocalContainer] at org.hippoecm.hst.core.sitemenu.HstSiteMenusImpl.<init>(HstSiteMenusImpl.java:35) [INFO] [talledLocalContainer] at org.hippoecm.hst.core.sitemenu.HstSiteMenusManagerImpl.getSiteMenus(HstSiteMenusManagerImpl.java:28) [INFO] [talledLocalContainer] at org.hippoecm.hst.core.container.SiteMenusResolvingValve.invoke(SiteMenusResolvingValve.java:30) [INFO] [talledLocalContainer] at org.hippoecm.hst.core.container.HstSitePipeline$Invocation.invokeNext(HstSitePipeline.java:271) [INFO] [talledLocalContainer] at org.hippoecm.hst.core.container.JCRSessionStatefulConcurrencyValve.invoke(JCRSessionStatefulConcurrencyValve.java:56) [INFO] [talledLocalContainer] at org.hippoecm.hst.core.container.HstSitePipeline$Invocation.invokeNext(HstSitePipeline.java:271) [INFO] [talledLocalContainer] at org.hippoecm.hst.core.container.SubjectBasedSessionValve.invoke(SubjectBasedSessionValve.java:58) [INFO] [talledLocalContainer] at org.hippoecm.hst.core.container.HstSitePipeline$Invocation.invokeNext(HstSitePipeline.java:271) [INFO] [talledLocalContainer] at org.hippoecm.hst.core.container.SecurityValve.invoke(SecurityValve.java:177) [INFO] [talledLocalContainer] at org.hippoecm.hst.core.container.HstSitePipeline$Invocation.invokeNext(HstSitePipeline.java:271) [INFO] [talledLocalContainer] at org.hippoecm.hst.core.container.LocalizationValve.invoke(LocalizationValve.java:96) [INFO] [talledLocalContainer] at org.hippoecm.hst.core.container.HstSitePipeline$Invocation.invokeNext(HstSitePipeline.java:271) [INFO] [talledLocalContainer] at org.hippoecm.hst.core.container.CmsSecurityValve.invoke(CmsSecurityValve.java:80) [INFO] [talledLocalContainer] at org.hippoecm.hst.core.container.HstSitePipeline$Invocation.invokeNext(HstSitePipeline.java:271) [INFO] [talledLocalContainer] at org.hippoecm.hst.core.container.InitializationValve.invoke(InitializationValve.java:72) [INFO] [talledLocalContainer] at org.hippoecm.hst.core.container.HstSitePipeline$Invocation.invokeNext(HstSitePipeline.java:271) [INFO] [talledLocalContainer] at org.hippoecm.hst.core.container.HstSitePipeline.invokeValves(HstSitePipeline.java:170) [INFO] [talledLocalContainer] at org.hippoecm.hst.core.container.HstSitePipeline.invoke(HstSitePipeline.java:153) [INFO] [talledLocalContainer] at org.hippoecm.hst.core.container.HstRequestProcessorImpl.processRequest(HstRequestProcessorImpl.java:79) [INFO] [talledLocalContainer] ... 25 more
And, here's the reason why NPE occurs on mount level, I figured out:
- WebApplicationInvokingPipeline is configured to execute siteMenusResolvingValve.
- siteMenusResolvingValve invokes HstSiteMenusManagerImpl.getSiteMenus(HstRequestContext), which initializes HstSiteMenusImpl(HstRequestContext).
- HstSiteMenusImpl expects a non-null resolved sitemap item by this line:
// find currently selected hstSiteMenuItemConfiguration's HstSiteMapItem selectedSiteMapItem = hstRequestContext.getResolvedSiteMapItem().getHstSiteMapItem();
- However, HstFilter doesn't/can't resolve a sitemap item if the named pipeline is invoked for the mount level. That's why it should always fail on mount level unfortunately.
The reason why it's working in the testsuite example (/springapp) is because it was configured in sitemap item level.
A quick solution would be to make SiteMenusResolvingValve not try to resolve sitemenu if there's no resolved sitemap item.