7.2.X, 7.3.X, Master
A data inconsistency in some page permissions causes Liferay to stop working, "An unexpected system error occurred" error is displayed on the browser and you are not able to login
This can easily reproduced in case you have a children Layout without ResourcePermission records, a
java.lang.IllegalArgumentException is thrown and it is not catch anywhere, so it is finally displayed directly to the final user.
As you are not able to enter in the Liferay user interface, it is not possible to fix the problem unless you manually update the database.
The root cause of the user interface error is in the TemplateContextHelper class, as it is including in the context object a navItems that contains all the Navigation items, but in case it fails, the error is not catch and it is directly displayed to the final user.
Just changing the exception catch from PortalException to Exception will avoid the error on the user interface but it will be written to the log file.
Steps to reproduce
- Create a widget page called ParentPage
- Create a child widget page of ParentPage called ChildPage
- Execute following SQL to delete the resource permissions record and generate a fake database inconsistence:
- delete from resourcepermission where primKeyId in (select plid from layout where name like '%ChildPage%') and name = 'com.liferay.portal.kernel.model.Layout'
- Restart Liferay server to clean all the caches
- Try to login:
- Even though there are IllegalArgumentException exceptions in the log file, you can login in the Liferay installation
- You cannot login in the Liferay installation, An unexpected system error occurred message is displayed in the browser and it is not possible to log in
LPS-154778 A permission inconsistency makes the portal unusable