I have a situation where an arraylist is being populated with one null value (I have no control over that). I need to check if the entry in the list is null and I cannot seem to make that work. How do I check the entry found in the list to see if it has value null? I thought the choice below was right but when I run a test I fall in the not null path. I know (from logging) that the value is showing null in the log.
<set-variable variableName="workOrderMap" value="#[deinstallMsg.workOrderMap[parentWorkOrderGroupId].nextWorkOrderTypes]" />
<foreach doc:name="For Each Child Work Order" collection="#[workOrderMap]" rootMessageVariableName="msg">
<set-variable variableName="childWorkOrderType" value="#[payload]" />
<choice doc:name="check for null">
<when expression="#[childWorkOrderType != null]">
<logger message="EDFEDFEDF found NOT null workordertype" level="INFO" doc:name="null check"/>
</when>
<otherwise>
<logger message="EDFEDFEDF workordertype: #[childWorkOrderType] IS NULL" level="INFO" doc:name="null check"/>
</otherwise>
</choice>
</foreach>
Try the this which includes whitespace
If childWorkOrderType is a list, use
As I was debugging and trying different things I figured out - what I was seeing was not a null. Rather what I was seeing was the content of the field was set to the value null. So when I changed from checking for null to comparing to the string null all worked as expected.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.