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

ConfigurationPersistenceManager should verify configuration from file before adding record to Configuration_ table

    Details

      Description

      When administrators contribute a .config file under osgi/config, they may provide a file which is not correctly formatted.

      For example, we do not support #comments in those files and developers may use some unsupported character escaping.

      As soon as a wrong configuration is pushed to the Configuration_ table, admins won't be able restart Liferay. Submitting a correctly formatted configuration file won't help because Liferay will try (and fail) to load the wrong Configuration_ record in the DB before looking at the newly submitted configuration file.

      This error will be displayed:

      Caused by: java.lang.NullPointerException 
      at org.apache.felix.cm.impl.helper.TargetedPID.<init>(TargetedPID.java:61) 
      at org.apache.felix.cm.impl.ConfigurationImpl.<init>(ConfigurationImpl.java:183) 
      at org.apache.felix.cm.impl.ConfigurationManager.getConfiguration(ConfigurationManager.java:452) 
      at org.apache.felix.cm.impl.ConfigurationAdminImpl.getConfiguration(ConfigurationAdminImpl.java:164) 
      at com.liferay.portal.file.install.internal.ConfigInstaller._getConfiguration(ConfigInstaller.java:357) 
      at com.liferay.portal.file.install.internal.ConfigInstaller._setConfig(ConfigInstaller.java:393) 
      at com.liferay.portal.file.install.internal.ConfigInstaller.transformURL(ConfigInstaller.java:252)

      There is then no other choice than manually deleting that wrong record in the Database.

      In order to avoid reaching this state, I suggest we add a Dictionary verification step in this method: https://github.com/liferay/liferay-portal/blob/master/modules/apps/static/portal-configuration/portal-configuration-persistence-impl/src/main/java/com/liferay/portal/configuration/persistence/internal/ConfigurationPersistenceManager.java#L229

       

        Attachments

          Activity

            People

            Assignee:
            support-lep@liferay.com SE Support
            Reporter:
            fabian.bouche Fabian Bouché
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Packages

                Version Package