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

An NPE is thrown if you try to publish a page that is a link to a child page

    Details

      Description

      NPE is thrown in some situations during Layout import process when page has "Link to Page" type:

      • Staging: NPE is thrown if you try to publish a page that it is link to one of its child page. (This publish operation error is not reproduced in 6.2.x)
      • Site templates: NPE is also thrown if you have a site template with a page link and try to propagate changes to a site

      Steps to reproduce (staging) note: not reproduced in 6.2.x

      1. Create a new site with one page called Page1 with type=Layout
      2. Activate staging
      3. Create a new Page2 with type=Layout
      4. Create a child page called Page2.1 with type=Layout
      5. Edit Page2 and change its type to type="Link to a Page of This Site". At "Link to Page" select Page2.1
      6. Publish to live:
        • Wrong behavior: A NPE is thrown:
          11:20:44,483 DEBUG [liferay/background_task-5][LoggerExportImportLifecycleListener:459] Staged model {class: com.liferay.portal.kernel.model.LayoutFriendlyURL, groupId: 1119421, uuid: 67e9e76b-2789-4b05-b73d-d8b4ee40df67} import started
          11:20:44,517 DEBUG [liferay/background_task-5][LoggerExportImportLifecycleListener:473] Staged model {class: com.liferay.portal.kernel.model.LayoutFriendlyURL, groupId: 1119421, uuid: 67e9e76b-2789-4b05-b73d-d8b4ee40df67} import succeeded
          11:20:44,542 DEBUG [liferay/background_task-5][LoggerExportImportLifecycleListener:473] Staged model {class: com.liferay.portal.kernel.model.Layout, groupId: 1119421, uuid: a0a0564f-4128-4dbc-bda7-2c6c6ab38217} import succeeded
          11:20:44,567 DEBUG [liferay/background_task-5][LoggerExportImportLifecycleListener:459] Staged model {class: com.liferay.portal.kernel.model.Layout, groupId: 1119421, uuid: b2477210-d2ad-4321-adca-ea9333c13dc7} import started
          11:20:44,591 DEBUG [liferay/background_task-5][LayoutStagedModelDataHandler:490] Layout with {groupId=3461534,privateLayout=false,layoutId=41} does not exist
          11:20:44,600 DEBUG [liferay/background_task-5][LayoutStagedModelDataHandler:576] Importing layout with layout id 41 and parent layout id 0
          11:20:44,631 DEBUG [liferay/background_task-5][LoggerExportImportLifecycleListener:459] Staged model {class: com.liferay.portal.kernel.model.Layout, groupId: 1119421, uuid: 30c313b4-dc9f-44df-820e-233963fc8228} import started
          11:20:44,653 DEBUG [liferay/background_task-5][LayoutStagedModelDataHandler:490] Layout with {groupId=3461534,privateLayout=false,layoutId=42} does not exist
          11:20:44,689 DEBUG [liferay/background_task-5][LoggerExportImportLifecycleListener:444] Staged model {class: com.liferay.portal.kernel.model.Layout, groupId: 1119421, uuid: 30c313b4-dc9f-44df-820e-233963fc8228} import failed
          java.lang.NullPointerException
          	at com.liferay.layout.admin.web.lar.LayoutStagedModelDataHandler.doImportStagedModel(LayoutStagedModelDataHandler.java:565)
          	at com.liferay.layout.admin.web.lar.LayoutStagedModelDataHandler.doImportStagedModel(LayoutStagedModelDataHandler.java:92)
          	at com.liferay.exportimport.kernel.lar.BaseStagedModelDataHandler.importStagedModel(BaseStagedModelDataHandler.java:364)
          	at com.liferay.exportimport.kernel.lar.StagedModelDataHandlerUtil.importStagedModel(StagedModelDataHandlerUtil.java:367)
          	at com.liferay.layout.admin.web.lar.LayoutStagedModelDataHandler.importLinkedLayout(LayoutStagedModelDataHandler.java:1031)
          	at com.liferay.layout.admin.web.lar.LayoutStagedModelDataHandler.doImportStagedModel(LayoutStagedModelDataHandler.java:607)
          	at com.liferay.layout.admin.web.lar.LayoutStagedModelDataHandler.doImportStagedModel(LayoutStagedModelDataHandler.java:92)
          	at com.liferay.exportimport.kernel.lar.BaseStagedModelDataHandler.importStagedModel(BaseStagedModelDataHandler.java:364)
          	at com.liferay.exportimport.kernel.lar.StagedModelDataHandlerUtil.importStagedModel(StagedModelDataHandlerUtil.java:367)
          	at com.liferay.exportimport.kernel.lar.StagedModelDataHandlerUtil.importStagedModel(StagedModelDataHandlerUtil.java:353)
          	at com.liferay.exportimport.controller.LayoutImportController.importLayout(LayoutImportController.java:990)
          	at com.liferay.exportimport.controller.LayoutImportController.doImportFile(LayoutImportController.java:685)
          	at com.liferay.exportimport.controller.LayoutImportController.importFile(LayoutImportController.java:218)
          	at com.liferay.portlet.exportimport.service.impl.ExportImportLocalServiceImpl.importLayouts(ExportImportLocalServiceImpl.java:185)
          

      Steps to reproduce (site templates) note: reproduced in both 6.2.x and master

      1. Create a new site template called "LPS-64160 Template" with one page called Page1 with type=Layout
      2. Create a new Page2 with type=Layout
      3. Edit Page1 and change its type to type="Link to a Page of This Site". At "Link to Page" select Page2
      4. Create a new site using previous created template "LPS-64160 Template"
      5. Check that site has same pages than template
      6. Edit site template (LPS-64160 Template)
      7. Create a new Page3 with type=Layout
      8. Change Page1 link destination from Page2 to new Page3
      9. Edit Page2 friendly url from Page2 to Page2.old
      10. Edit Page3 friendly url from Page3 to Page2
      11. Open a page of previous created site in order to propagate changes from Template to site
        • Expected behavior: Changes are propagate from Template to site: new Page3 is shown
        • Wrong behavior: Changes are not propagated from Template to site: new Page3 is notshown. A NPE is thrown:
          08:18:22,499 ERROR [http-bio-8080-exec-6][SitesImpl:1288] com.liferay.portal.kernel.lar.PortletDataException: java.lang.NullPointerException
          com.liferay.portal.kernel.lar.PortletDataException: java.lang.NullPointerException
                  at com.liferay.portal.kernel.lar.BaseStagedModelDataHandler.importStagedModel(BaseStagedModelDataHandler.java:177)
                  at com.liferay.portal.kernel.lar.StagedModelDataHandlerUtil.importStagedModel(StagedModelDataHandlerUtil.java:340)
                  at com.liferay.portal.kernel.lar.StagedModelDataHandlerUtil.importStagedModel(StagedModelDataHandlerUtil.java:330)
                  at com.liferay.portal.lar.LayoutImporter.importLayout(LayoutImporter.java:936)
                  at com.liferay.portal.lar.LayoutImporter.doImportLayouts(LayoutImporter.java:666)
                  at com.liferay.portal.lar.LayoutImporter.importLayouts(LayoutImporter.java:249)
          [...]
                  at com.liferay.portal.service.LayoutLocalServiceUtil.importLayouts(LayoutLocalServiceUtil.java:1282)
                  at com.liferay.portlet.sites.util.SitesImpl.importLayoutSetPrototype(SitesImpl.java:1836)
                  at com.liferay.portlet.sites.util.SitesImpl.mergeLayoutSetPrototypeLayouts(SitesImpl.java:1283)
                  at com.liferay.portlet.sites.util.SitesUtil.mergeLayoutSetPrototypeLayouts(SitesUtil.java:283)
                  at com.liferay.portal.service.impl.LayoutLocalServiceVirtualLayoutsAdvice.mergeLayoutSetPrototypeLayouts(LayoutLocalServiceVirtualLayoutsAdvice.java:295)
                  at com.liferay.portal.service.impl.LayoutLocalServiceVirtualLayoutsAdvice.invoke(LayoutLocalServiceVirtualLayoutsAdvice.java:135)
                  at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
          [...]
                  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
                  at java.lang.Thread.run(Thread.java:745)
          Caused by: java.lang.NullPointerException
                  at com.liferay.portlet.layoutsadmin.lar.LayoutStagedModelDataHandler.importLinkedLayout(LayoutStagedModelDataHandler.java:912)
                  at com.liferay.portlet.layoutsadmin.lar.LayoutStagedModelDataHandler.doImportStagedModel(LayoutStagedModelDataHandler.java:477)
                  at com.liferay.portlet.layoutsadmin.lar.LayoutStagedModelDataHandler.doImportStagedModel(LayoutStagedModelDataHandler.java:1)
                  at com.liferay.portal.kernel.lar.BaseStagedModelDataHandler.importStagedModel(BaseStagedModelDataHandler.java:166)
                  ... 227 more
          

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              felix.zhang Felix Zhang
              Reporter:
              jorge.diaz Jorge Diaz
              Participants of an Issue:
              Recent user:
              Enterprise Release HU
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 14 weeks, 5 days ago

                  Packages

                  Version Package
                  6.2.X EE
                  7.0.0 CE RC1