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

Undeployed portlet returned by getPortletById shouldn't be registered in Service Registry

    Details

      Description

      PortletLocalServiceImpl.getPortletById(long companyId, String portletId) method gets portlet object from database, but in case the portlet doesn't exists, a dummy undeployed portlet is created with following configuration:

      portlet = new PortletImpl(CompanyConstants.SYSTEM, portletId);

      PortletApp portletApp = getPortletApp(StringPool.BLANK);
      portlet.setPortletApp(portletApp);

      portlet.setPortletName(portletId);
      portlet.setDisplayName(portletId);
      portlet.setPortletClass(UndeployedPortlet.class.getName());
      [...]
      portlet.setActive(true);
      portlet.setReady(true);
      portlet.setUndeployedPortlet(true);

      The main problem is portlet.setReady(true); method registers this dummy portlet in Service Registry, see:

      This regression is caused by LPS-97175 and it can cause some unexpected issues:

      1. In version 7.0 a exception is caused if you start Liferay with a empty database and a clean osgi/state, see: https://issues.liferay.com/browse/LRQA-51895?focusedCommentId=1945316&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-1945316
      2. In version 7.1 I was able to reproduce same error but only in case I am doing remote debuging
      3. I wasn't able to reproduce 7.0 issue in 7.2 or master, but the code is also wrong in that version, so I think we should fix it in all branches.

      Steps to reproduce

      This LPS cannot be reproduced in master

      7.0.x branch: It can be tested in 7.0.x using following steps:

      1. Install a clean Liferay bundle
      2. Copy "1975 London theme" to deploy folder
      3. Configure Liferay with a empty database
      4. Delete osgi/state
      5. Start Liferay
        • Wrong behavior: a exception will be thrown during startup (see LRQA-51895)
        • Expected behavior: no exception is thrown

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                summer.zhang Summer Zhang
                Reporter:
                jorge.diaz Jorge Diaz
                Participants of an Issue:
                Recent user:
                Jason Pince
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  9 weeks ago

                  Packages

                  Version Package
                  7.0.0 DXP FP87
                  7.0.10.12 DXP SP12
                  7.0.X
                  7.1.X
                  7.2.10 DXP FP2
                  7.2.10.1 DXP SP1
                  7.2.X
                  7.2.1 CE GA2
                  Master