Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-140379

Register ObjectEntriesPanelApp after ObjectEntriesPortlet to prevent NPE

Details

    Description

      ObjectEntriesPanelApp can sometimes throw a NPE.

      1.) Type: git ls-files **PanelApp.java

      Notice that all implemenetations have 

      {{ @Override @Override @Reference( target = "(javax.portlet.name=" + SiteAdminPortletKeys.SITE_ADMIN + ")", unbind = "-" ) public void setPortlet(Portlet portlet) { super.setPortlet(portlet); }}}

      2.) See PanelAppRegistry.java

      {{ Portlet portlet = _portletLocalService.getPortletById( Portlet portlet = _portletLocalService.getPortletById( panelApp.getPortletId());}}
      {{ if (portlet != null) { portlet.setControlPanelEntryCategory(panelCategoryKey);}}
      {{ panelApp.setPortlet(portlet); }}}

      To ensure  that the portlet is never NULL, register ObjectEntriesPanelApp AFTER  ObjectEntriesPortlet is registered.

      3.) See exception log: 

      Caused by: java.lang.NullPointerException
      {{ at com.liferay.application.list.BasePanelApp.getGroup(BasePanelApp.java:205) ~[bundleFile:?]}}
      {{ at com.liferay.application.list.BasePanelApp.getPortletURL(BasePanelApp.java:118) ~[bundleFile:?]}}
      {{ at com.liferay.object.web.internal.object.entries.application.list.ObjectEntriesPanelApp.getPortletURL(ObjectEntriesPanelApp.java:62) ~[?:?]}}
      {{ at com.liferay.depot.web.internal.application.list.DepotPanelAppController$PanelAppWrapper.getPortletURL(DepotPanelAppController.java:209) ~[?:?]}}
      {{ at com.liferay.product.navigation.applications.menu.web.internal.portlet.action.ApplicationsMenuPanelAppsMVCResourceCommand._getPanelAppJSONObject(ApplicationsMenuPanelAppsMVCResourceCommand.java:175) ~[bundleFile:?]}}
      {{ at com.liferay.product.navigation.applications.menu.web.internal.portlet.action.ApplicationsMenuPanelAppsMVCResourceCommand._getPanelAppsJSONArray(ApplicationsMenuPanelAppsMVCResourceCommand.java:192) ~[bundleFile:?]}}
      {{ at com.liferay.product.navigation.applications.menu.web.internal.portlet.action.ApplicationsMenuPanelAppsMVCResourceCommand._getChildPanelCategoriesJSONArray(ApplicationsMenuPanelAppsMVCResourceCommand.java:124) ~[bundleFile:?]}}
      {{ at com.liferay.product.navigation.applications.menu.web.internal.portlet.action.ApplicationsMenuPanelAppsMVCResourceCommand._getPanelCategoriesJSONArray(ApplicationsMenuPanelAppsMVCResourceCommand.java:213) ~[bundleFile:?]}}
      {{ at com.liferay.product.navigation.applications.menu.web.internal.portlet.action.ApplicationsMenuPanelAppsMVCResourceCommand._getApplicationsMenuContextJSONObject(ApplicationsMenuPanelAppsMVCResourceCommand.java:99) ~[bundleFile:?]}}
      {{ at com.liferay.product.navigation.applications.menu.web.internal.portlet.action.ApplicationsMenuPanelAppsMVCResourceCommand.doServeResource(ApplicationsMenuPanelAppsMVCResourceCommand.java:84) ~[bundleFile:?]}}
      {{ at com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCResourceCommand.serveResource(BaseMVCResourceCommand.java:41) ~[portal-kernel.jar:?]}}
      {{ ... 157 more}}

      Attachments

        Activity

          People

            support-lep@liferay.com SE Support
            brian.chan Brian Chan
            Kiyoshi Lee Kiyoshi Lee
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Packages

                Version Package
                7.4.13 DXP GA1
                7.4.3.4 CE GA4
                Master