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

ConfigurationExtender generates factoryPid from configuration files in bundle incorrectly

    Details

      Description

      Affected

      Bundles containing configuration files in folder defined by "Liferay-Configuration-Path" in bnd.bnd (*.properties or *.config files), for example REST bundles using REST Extender.

      Steps to reproduce

      1. Deploy sample REST bundle using REST Extender https://github.com/liferay/liferay-blade-samples/tree/7.0/maven/apps/rest

      Expected result

      • REST Extender and CXF endpoint configuration registered and visible in Control Panel - Configuration - System Settings - Web API
      • REST endpoint accessible on URL defined in configuration

      Actual result

      • Configuration not registered and visible in Control panel
      • REST enpoint not accessible

      Probable cause

      After refactoring of ConfigurationExtender done in LPS-94399, method "_addNamedConfigurations" generates "factoryPid" of configuration based on configuration file's name incorrectly.

      Code

       

      int lastIndexOfSlash = name.lastIndexOf('/');
      ...
      factoryPid = name.substring(lastIndexOfSlash, index);
      

      causes "factoryPid" to start with slash, which shouldn't be there.

       

      For example: "/com.liferay.portal.remote.rest.extender.configuration.RestExtenderConfiguration"

      After that when ConfigurationModelRetrieverImpl::getFactoryConfigurations tries to find configurations of for example "com.liferay.portal.remote.rest.extender.configuration.RestExtenderConfiguration" without the slash, it fails to pick up this configuration.

      Possible workaround

      For most cases it should be possible to set up the configurations in Control Panel manually.

      For example set up REST Extender and CXF Endpoint in Control Panel - Configuration - System Settings - Web API manually to make the REST endpoint working.

      Note

      I am aware that using REST Extender for REST endpoints is no longer the preferred way in Liferay 7.2, but this bug in ConfigurationExtender can also have consequences in other use cases, and it seems it shouldn't be difficult to fix.

        Attachments

          Activity

            People

            • Assignee:
              support-lep@liferay.com SE Support
              Reporter:
              marek.vele Marek Véle
              Participants of an Issue:
              Recent user:
              Marek Véle
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Days since last comment:
                10 weeks, 6 days ago

                Packages

                Version Package