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

Using a workflow which automatically moves to the approved state results in NPE

    Details

      Description

      DESCRIPTION
      Blog posts get stuck at pending and throw a NullPointerException in the following scenario:
      1. If blog entry is created with checked "Allow pingbacks" and "Allow trackbacks" checkboxes.
      2. If the blog entry is set to be automatically approved.

      This is because when auto-approving, we are entering the BlogsEntryLocalServiceImpl.updateStatus() method without setting the theme display in the request. The theme display is then used and the NPE occurs.

      STEPS TO REPRODUCE
      1. Upload workflow definition (attached to the ticket) from control panel workflow screen OR Add New definition which has only Start State (create node) connecting to End State (approval node).
      2. Enable workflow for "blog-entry" resource under workflow configuration.
      3. Create blog from "site administration → content" section.
      4. Input following fields "title", "content", and leave "Allow pingbacks" checked. Click on "submit for publication" button.
      EXPECTED RESULTS
      Article gets approved
      ACTUAL RESULTS
      Article stays in pending and stacktrace appears:

      23:43:19,914 WARN  [liferay/workflow_status-1][ProxyMessageListener:84] com.liferay.portal.kernel.workflow.WorkflowException: java.lang.NullPointerException
      com.liferay.portal.kernel.workflow.WorkflowException: java.lang.NullPointerException
              at com.liferay.portal.workflow.WorkflowStatusManagerImpl.updateStatus(WorkflowStatusManagerImpl.java:41)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:483)
              at com.liferay.portal.kernel.messaging.proxy.ProxyRequest.execute(ProxyRequest.java:86)
              at com.liferay.portal.kernel.messaging.proxy.ProxyMessageListener.receive(ProxyMessageListener.java:54)
              at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:74)
              at com.liferay.portal.kernel.messaging.SerialDestination$1.run(SerialDestination.java:58)
              at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:756)
              at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:667)
              at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.NullPointerException
              at com.liferay.portal.util.PortalImpl.getLayoutFullURL(PortalImpl.java:2968)
              at com.liferay.portal.kernel.util.PortalUtil.getLayoutFullURL(PortalUtil.java:1159)
              at com.liferay.blogs.service.impl.BlogsEntryLocalServiceImpl.pingPingback(BlogsEntryLocalServiceImpl.java:2088)
              at com.liferay.blogs.service.impl.BlogsEntryLocalServiceImpl.updateStatus(BlogsEntryLocalServiceImpl.java:1606)
              at sun.reflect.GeneratedMethodAccessor1140.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:483)
              at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:67)
              at com.sun.proxy.$Proxy444.updateStatus(Unknown Source)
              at com.liferay.blogs.service.BlogsEntryLocalServiceWrapper.updateStatus(BlogsEntryLocalServiceWrapper.java:377)
              at com.liferay.mentions.internal.service.MentionsBlogsEntryServiceWrapper.updateStatus(MentionsBlogsEntryServiceWrapper.java:66)
              at sun.reflect.GeneratedMethodAccessor1140.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:483)
              at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:67)
              at com.sun.proxy.$Proxy445.updateStatus(Unknown Source)
              at sun.reflect.GeneratedMethodAccessor1140.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:483)
              at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:153)
              at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:54)
              at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:58)
              at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)
              at com.liferay.portal.service.ServiceContextAdvice.invoke(ServiceContextAdvice.java:51)
              at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)
              at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
              at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)
              at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
              at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:127)
              at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:174)
              at com.sun.proxy.$Proxy441.updateStatus(Unknown Source)
              at com.liferay.blogs.internal.workflow.BlogsEntryWorkflowHandler.updateStatus(BlogsEntryWorkflowHandler.java:68)
              at com.liferay.blogs.internal.workflow.BlogsEntryWorkflowHandler.updateStatus(BlogsEntryWorkflowHandler.java:38)
              at com.liferay.portal.kernel.workflow.WorkflowHandlerRegistryUtil.updateStatus(WorkflowHandlerRegistryUtil.java:245)
              at com.liferay.portal.workflow.WorkflowStatusManagerImpl.updateStatus(WorkflowStatusManagerImpl.java:38)
              ... 11 more
      

      ee-6.2.x
      Reproduced
      824de1dd96c48cc885421b59221534d72b4068eb
      MASTER/70x
      Reproduced
      0cd186e90b8dd24cdbd5f942a97702339672b93d

        Attachments

        1. Failed.PNG
          Failed.PNG
          19 kB
        2. Fixed.PNG
          Fixed.PNG
          20 kB
        3. Fixed70.PNG
          Fixed70.PNG
          27 kB
        4. single-approver-contributor-only-workflow Master.xml
          5 kB
        5. test.xml
          1 kB

          Issue Links

            Activity

              People

              Assignee:
              harry.chai Harry Chai
              Reporter:
              christopher.kian Christopher Kian
              Participants of an Issue:
              Recent user:
              Csaba Turcsan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                5 years, 8 weeks ago

                  Packages

                  Version Package
                  7.0.0 DXP SP2
                  7.0.0 DXP FP13
                  7.0.0 DXP SP3
                  7.0.3 CE GA4
                  7.1.X
                  Master