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

Unable to delete portal instance when ldap.password.policy.enabled=true

    Details

      Description

      Steps to reproduce

      On ee-6.2.x:

      1) Set ldap.password.policy.enabled=true
      2) Log in as default admin and go to control-panel->configuration->portal instances
      3) Create a new portal instance (entered values are not relevant)
      4) Try to delete the created instance

      Expected behavior: The instance is deleted.
      Issue: In the GUI Portal Instances is temporarily unavailable error-message is shown. In the log, the following Stacktrace can be seen:

      09:03:57,306 ERROR [http-nio-8443-exec-55][render_portlet_jsp:132] null
      java.lang.NullPointerException
      	at com.liferay.portal.systemevent.SystemEventAdvice.isValid(SystemEventAdvice.java:292)
      	at com.liferay.portal.systemevent.SystemEventAdvice.before(SystemEventAdvice.java:123)
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:44)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
      

      On master:

      PPLSI.getDefaultPasswordPolicy() returns null if LDAP pwd policy is enabled, which is intended, but on current master I wasn't able to turn it on. I tried the mentioned property and tried to set it from control panel manually. However DefaultLDAPSettings.isPasswordPolicyEnabled() always returned false.

      Thus, the orignal issue on master can be reproduced with the following Beanshell script.

      import com.liferay.portal.service.*;
      
      try {
        policy = PasswordPolicyLocalServiceUtil.deletePasswordPolicy(null);
      }
      catch (Exception e) {
        e.printStackTrace();
      }
      

      Thereafter it throws the same exception:

      java.lang.NullPointerException
      	at com.liferay.portal.systemevent.SystemEventAdvice.isValid(SystemEventAdvice.java:287)
      	at com.liferay.portal.systemevent.SystemEventAdvice.before(SystemEventAdvice.java:123)
      	at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:44)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:123)
      	at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:173)
      	at com.sun.proxy.$Proxy124.deletePasswordPolicy(Unknown Source)
      	at com.liferay.portal.service.PasswordPolicyLocalServiceUtil.deletePasswordPolicy(PasswordPolicyLocalServiceUtil.java:135)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at bsh.Reflect.invokeMethod(Unknown Source)
      	at bsh.Reflect.invokeStaticMethod(Unknown Source)
      	at bsh.Name.invokeMethod(Unknown Source)
      	at bsh.BSHMethodInvocation.eval(Unknown Source)
      

      Notes for QA

      When testing on master, the provided Beanshell script is expected to throw an NPE in PasswordPolicyLocalServiceImpl.deletePasswordPolicy(). Neverthless, NPE in SystemEventAdvice.isValid() is what the fix eliminates.

        Attachments

        1. catalina.2015-03-02.log
          2 kB
        2. fixed.png
          fixed.png
          78 kB
        3. liferay.2015-03-02.log
          21 kB
        4. reproduced.png
          reproduced.png
          63 kB

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  4 years, 29 weeks, 2 days ago

                  Packages

                  Version Package
                  6.2.3 CE GA4
                  6.2.X EE
                  7.0.0 M4