java.lang.UnsupportedOperationException after upgrade to 7.6.0

Hi experts,

After upgrading Bonita from 7.4.3 to 7.6.0 we’re having this exception in a Groovy Script:

org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: Groovy script throws an exception of type class java.lang.UnsupportedOperationException with message = No message

This is the code:

import java.util.logging.Logger;import com.ah.model.AMEApprovers;

Logger logger= Logger.getLogger("org.bonitasoft.groovy.script.copy_approvers");

logger.info("ameApprovers.size()"+ameApprovers.size())
logger.info("ameApproversTmp.size()"+app:ameApproversTmp.size())

for (AMEApprovers app:ameApproversTmp) {
  logger.info("In loop") 
   ameApprovers.add(app)
}

return ameApprovers

It’s failing in the line after “In loop” trace. Do we need to do some sort of initialization not needed before?

Regards,
Jose.

Hi,

We’ve changed the code to this

for (AMEApprovers app:ameApproversTmp) {
   logger.info("In loop") 
   /*ameApprovers.add(app)*/
   ameApprovers += app
}

And now works fine.

Best regards,
Jose.

Are you able to share a simplified version of your process (export from 7.4.3) that can be used to reproduce the issue?
Or maybe at least your business data model.

Thanks

Thanks for your help Antoine.

Both variables ameApprovers and ameApproverTmp are List<com.ah.model.AMEApprovers>.

ameApprovers is defined as Business Variable and ameApproversTmp is defined as Process Variable.

As I’m here just copying one list into another, perhaps can you suggest a better approach as workaround?

Here you have the BDM:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<businessObjectModel modelVersion="1.0" productVersion="7.2.3">
    <businessObjects>
        <businessObject qualifiedName="com.ah.model.AMEProcesses">
            <fields>
                <field type="LONG" length="255" name="ameProcessId" nullable="false" collection="false"/>
                <field type="STRING" length="80" name="processName" nullable="false" collection="false"/>
                <field type="STRING" length="8" name="processType" nullable="true" collection="false"/>
                <field type="STRING" length="2" name="approverType" nullable="true" collection="false"/>
                <field type="STRING" length="1" name="approvalType" nullable="true" collection="false"/>
                <field type="LONG" length="255" name="appId" nullable="false" collection="false"/>
                <field type="INTEGER" length="255" name="remindersNum" nullable="false" collection="false"/>
                <field type="LONG" length="255" name="responseTimeout" nullable="false" collection="false"/>
                <field type="STRING" length="120" name="mailApproverSubject" nullable="true" collection="false"/>
                <field type="TEXT" length="4000" name="mailApproverBody" nullable="true" collection="false"/>
                <field type="STRING" length="120" name="mailRequesterSubject" nullable="true" collection="false"/>
                <field type="TEXT" length="4000" name="mailRequesterBody" nullable="true" collection="false"/>
                <field type="STRING" length="120" name="mailNoResponseSubject" nullable="true" collection="false"/>
                <field type="TEXT" length="4000" name="mailNoResponseBody" nullable="true" collection="false"/>
                <field type="STRING" length="255" name="mailReminderSubject" nullable="true" collection="false"/>
                <field type="TEXT" length="255" name="mailReminderBody" nullable="true" collection="false"/>
                <field type="STRING" length="1" name="enabledFlag" nullable="true" collection="false"/>
            </fields>
            <uniqueConstraints/>
            <queries/>
            <indexes/>
        </businessObject>
        <businessObject qualifiedName="com.ah.model.AMERequests">
            <fields>
                <field type="LONG" length="255" name="ameApprovalId" nullable="true" collection="false"/>
                <field type="LONG" length="255" name="initiatorUserId" nullable="true" collection="false"/>
                <field type="STRING" length="255" name="initiatorUserName" nullable="true" collection="false"/>
                <field type="LONG" length="255" name="requestUserId" nullable="true" collection="false"/>
                <field type="STRING" length="255" name="requestUserName" nullable="true" collection="false"/>
                <field type="STRING" length="4000" name="status" nullable="true" collection="false"/>
                <field type="INTEGER" length="255" name="isPreapproved" nullable="true" collection="false"/>
            </fields>
            <uniqueConstraints/>
            <queries/>
            <indexes/>
        </businessObject>
        <businessObject qualifiedName="com.ah.model.AMEApprovers">
            <fields>
                <field type="LONG" length="255" name="userId" nullable="true" collection="false"/>
                <field type="STRING" length="255" name="userName" nullable="true" collection="false"/>
                <field type="STRING" length="255" name="firstName" nullable="true" collection="false"/>
                <field type="STRING" length="255" name="email" nullable="true" collection="false"/>
                <field type="STRING" length="255" name="status" nullable="true" collection="false"/>
                <field type="INTEGER" length="255" name="currentLevel" nullable="true" collection="false"/>
                <field type="INTEGER" length="255" name="remindersSent" nullable="true" collection="false"/>
                <field type="STRING" length="255" name="delegatedTo" nullable="true" collection="false"/>
                <field type="STRING" length="255" name="delegatedToEmail" nullable="true" collection="false"/>
                <field type="STRING" length="255" name="roleId" nullable="true" collection="false"/>
                <field type="INTEGER" length="255" name="dataGroupLid" nullable="true" collection="false"/>
            </fields>
            <uniqueConstraints/>
            <queries/>
            <indexes/>
        </businessObject>
    </businessObjects>
</businessObjectModel>

In order to better understanding your use case it would be really helpful if I can take a look at the diagram and try to figure in which situation your are doing this list copy.

So can you share the diagram export as a .bos file for example using Google Drive or Dropbox.

Thanks

Here you have:
https://drive.google.com/open?id=1YqPMOG9y2HQ1paN9aU6t1Meobf7-oxp1

Phase: Get Next Approver, Operation: copyApprovers

I’ll try to sum up my understanding of you use case: you have a list of approvers stored in an external Oracle database and you want to load it in your process business data.

What I currently don’t understand is why you use and intermediate process variable to store the list of approvers (ameApproversTmp) instead of directly use output of the Groovy script (that run the SQL query) to initialize the business variable?

As you already duplicate the data that are stored in Oracle database in the Bonita Business Database I think it would be nice to avoid another duplication by avoiding using this process variables.

Hi Antoine, thanks for your effort.
The flow is prepared to have several approvers at the same level and need the approval of all of them to continue.
I need it duplicated to track the remainder email sent and not sent remainders to whoever already has made his/her job.
The code is just a copy of Lists… what have changed in this release of Bonita to stop working?