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

Creating a new virtual instance won't use Default Locales correctly

    Details

      Description

      Reproduction steps:

      1.) Go to Control Panel > Configuration > Instance Settings > Miscellaneous 
      2.) Under Available Languages > Current (left panel), move all languages except English (United States) in the list to the Available list on the right panel

      3.) Move Italian (Italy) from the Available panel to the Current one. The final result before saving should be:

      Default Language >
      English (United States)

      Current >
      English (United States)
      Italian (Italy)

      Available >
      (All others)

      Click on the Save button on the bottom.

      4.) Now, make Italian (Italy) the default language, so that all settings turn to be:

      Default Language >
      Italian (Italy)

      Current >
      English (United States)
      Italian (Italy)

      Available >
      (All others)

      Click on the Save button on the bottom.

      5.) Go to Control Panel > Configuration > Virtual Instances
      6.) Click on the top-right plus  button
      7.) Add a new instance with the value www.otherinstance.com in all required fields and Save

      Expected: no exceptions in the log

      Actual: Null Pointer Exceptions in the logs:

      2018-10-15 05:49:11.449 WARN  [http-nio-9090-exec-1][PortalInstanceLifecycleListenerManagerImpl:136] Unable to register portal instance {mvccVersion=1, companyId=37227, accountId=37229, webId=www.othersite.com, key=9/niCVaAlXHMVfRi7cLsog==, mx=www.otherinstance.com, homeURL=, logoId=0, system=false, maxUsers=0, active=true}
      java.lang.NullPointerException
      	at com.liferay.portal.service.impl.LayoutLocalServiceHelper.validateName(LayoutLocalServiceHelper.java:480)
      	at com.liferay.portal.service.impl.LayoutLocalServiceHelper.validate(LayoutLocalServiceHelper.java:234)
      	at com.liferay.portal.service.impl.LayoutLocalServiceImpl.addLayout(LayoutLocalServiceImpl.java:216)
      	at sun.reflect.GeneratedMethodAccessor1027.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at com.liferay.portal.service.impl.LayoutLocalServiceStagingAdvice$LayoutLocalServiceStagingInvocationHandler._invoke(LayoutLocalServiceStagingAdvice.java:750)
      	at com.liferay.portal.service.impl.LayoutLocalServiceStagingAdvice$LayoutLocalServiceStagingInvocationHandler.invoke(LayoutLocalServiceStagingAdvice.java:637)
      	at com.sun.proxy.$Proxy218.addLayout(Unknown Source)
      ...
      2018-10-15 05:49:15.968 WARN  [http-nio-9090-exec-1][PortalInstanceLifecycleListenerManagerImpl:136] Unable to register portal instance {mvccVersion=1, companyId=37227, accountId=37229, webId=www.othersite.com, key=9/niCVaAlXHMVfRi7cLsog==, mx=www.otherinstance.com, homeURL=, logoId=0, system=false, maxUsers=0, active=true}
      java.lang.NullPointerException
      	at com.liferay.portal.service.impl.LayoutLocalServiceHelper.validateName(LayoutLocalServiceHelper.java:480)
      	at com.liferay.portal.service.impl.LayoutLocalServiceHelper.validate(LayoutLocalServiceHelper.java:234)
      	at com.liferay.portal.service.impl.LayoutLocalServiceImpl.addLayout(LayoutLocalServiceImpl.java:216)
      	at sun.reflect.GeneratedMethodAccessor1027.invoke(Unknown Source)
      ...
      	at com.liferay.portal.kernel.util.DefaultLayoutPrototypesUtil.addLayout(DefaultLayoutPrototypesUtil.java:63)
      	at com.liferay.document.library.layout.set.prototype.internal.instance.lifecycle.AddLayoutSetPrototypePortalInstanceLifecycleListener.addPrivateSite(AddLayoutSetPrototypePortalInstanceLifecycleListener.java:83)
      	at com.liferay.document.library.layout.set.prototype.internal.instance.lifecycle.AddLayoutSetPrototypePortalInstanceLifecycleListener.portalInstanceRegistered(AddLayoutSetPrototypePortalInstanceLifecycleListener.java:61)
      	at com.liferay.portal.instance.lifecycle.internal.PortalInstanceLifecycleListenerManagerImpl.registerCompany(PortalInstanceLifecycleListenerManagerImpl.java:132)
      	at com.liferay.portal.instance.lifecycle.internal.PortalInstanceLifecycleListenerManagerImpl.registerCompany(PortalInstanceLifecycleListenerManagerImpl.java:62)
      	at com.liferay.portal.service.impl.CompanyLocalServiceImpl.registerCompany(CompanyLocalServiceImpl.java:1540)
      	at com.liferay.portal.service.impl.CompanyLocalServiceImpl$1.call(CompanyLocalServiceImpl.java:453)
      	at com.liferay.portal.service.impl.CompanyLocalServiceImpl$1.call(CompanyLocalServiceImpl.java:449)
      

       

      Root cause:

      While creating the new company when the <XYZ>LayoutFactory classes are creating the default Layouts they are using the original company's siteDefaultLocale (in this case Italian) and if that locale is not in the 
      locales.enabled
      property, then the name validation of the Layouts fail.

       

      Solution:

      Newly created companies should the portal's siteDefaultLocale to create their default Layouts.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  50 weeks, 4 days ago

                  Packages

                  Version Package
                  7.0.0 DXP FP62
                  7.0.X
                  7.1.1 CE GA2
                  7.1.10 DXP FP4
                  7.1.10.1 SP1
                  7.1.X
                  Master