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

Getting Recipients email adress from non regular roles in a state action for notification fails

    Details

    • Branch Version/s:
      6.1.x, 6.0.x
    • Backported to Branch:
      Committed

      Description

      With such a definition, the notification fails after changing to Approved:
      <state>
      <name>approved</name>
      <actions>
      ...
      <notification>
      ...
      <recipients>
      ...
      <role>
      <role-type>site</role-type>
      <name>Site Content Reviewer</name>
      </role>
      ...
      </recipients>
      </notification>
      </actions>

      </state>

      Steps to reproduce it:
      1- Config Liferay to send emails and deploy kaleo web plugin
      2- Create a site role called "no_regular" (community role for 6.0.x)
      3- Modifiy/create a user using your email
      4- Assign that user to that role in the liferay.com site
      [Work in liferay.com for the points below]
      5- Import the attached workflow definition "single-approver-nonregular-role-when-approved-notification.xml"
      6- Select the workflow "Notificate non regular when approved" for web contents
      7- Create and send to publish one content
      8- With an administrator user, assign and approved the content

      Result:
      You won't receive any email and the following exception is thrown:

      18:37:42,239 ERROR [ParallelDestination:80] Unable to process message {destinationName=liferay/kaleo_graph_walker, response=null, responseDestinationName=null, responseId=null, payload=com.liferay.portal.workflow.kaleo.runtime.graph.PathElement@3cd12c3d, values={companyId=10136}}
      com.liferay.portal.kernel.messaging.MessageListenerException: com.liferay.portal.workflow.kaleo.runtime.notification.NotificationMessageSenderException: Unable to send mail message
      	at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:31)
      	at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:65)
      	at com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:77)
      	at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:669)
      	at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:580)
      	at java.lang.Thread.run(Unknown Source)
      Caused by: com.liferay.portal.workflow.kaleo.runtime.notification.NotificationMessageSenderException: Unable to send mail message
      	at com.liferay.portal.workflow.kaleo.runtime.notification.EmailNotificationSender.sendNotification(EmailNotificationSender.java:94)
      	at com.liferay.portal.workflow.kaleo.runtime.notification.NotificationUtil._sendKaleoNotification(NotificationUtil.java:77)
      	at com.liferay.portal.workflow.kaleo.runtime.notification.NotificationUtil.sendKaleoNotifications(NotificationUtil.java:44)
      	at com.liferay.portal.workflow.kaleo.runtime.graph.DefaultGraphWalker.follow(DefaultGraphWalker.java:81)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      	at java.lang.reflect.Method.invoke(Unknown Source)
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
      	at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:86)
      	at com.liferay.portal.dao.jdbc.aop.DynamicDataSourceTransactionInterceptor.invoke(DynamicDataSourceTransactionInterceptor.java:46)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
      	at $Proxy291.follow(Unknown Source)
      	at com.liferay.portal.workflow.kaleo.runtime.graph.messaging.PathElementMessageListener.doReceive(PathElementMessageListener.java:53)
      	at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:25)
      	... 5 more
      Caused by: java.lang.NullPointerException
      	at com.liferay.portal.workflow.kaleo.runtime.notification.EmailNotificationSender.getRoleRecipientAddresses(EmailNotificationSender.java:212)
      	at com.liferay.portal.workflow.kaleo.runtime.notification.EmailNotificationSender.getRecipients(EmailNotificationSender.java:178)
      	at com.liferay.portal.workflow.kaleo.runtime.notification.EmailNotificationSender.sendNotification(EmailNotificationSender.java:72)
      

      It's because on com.liferay.portal.workflow.kaleo.runtime.notification.EmailNotificationSender.getRoleRecipientAddresses(...), near line 180, the groupId is taken from the kaleoTaskInstanceToken, wich is null in this case (probably because we are in a State and not in a Task). Then the UserGroupRoleLocalServiceUtil.getUserGroupRolesByGroupAndRole(...) failed with a null pointer exception.

      Applying the commit you will receive one meail with the subject "New content has been published" and the following content:
      "Notification to users belong to a non-regular role after changing to the state Approved"

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  4 years, 35 weeks, 6 days ago