Null Iterator

Discussions about the LSPS expression language.
Forum rules
Make sure every topic contains information about your LSPS version and if relevant also your server OS, client OS, database name and version, and application server name and version.
matt.price
 
Posts: 66
Joined: Thu May 03, 2012 11:51 pm

Null Iterator

Thu Apr 03, 2014 4:12 pm

What scenarios would cause an iterator to become null? Sorry I know this isn't much to go on.

Code: Select all
09:37:47,916 ERROR (http--0.0.0.0-8080-4) Error invoking method public com.whitestein.lsps.human.dto.TodoList com.whitestein.lsps.human.TodoServiceBean.submitTodo(long,com.whitestein.lsps.common.ByteData) throws com.whitestein.lsps.human.exception.TodoNotFoundException,com.whitestein.lsps.human.exception.InvalidTodoStatusException,com.whitestein.lsps.human.exception.TodoNotAllocatedException,com.whitestein.lsps.human.exception.TodoAllocatedException,com.whitestein.lsps.common.ErrorException: com.whitestein.lsps.common.ErrorException: Mandatory expression 'ps' has null value, error code: NullParameterError in select(collectionOfLP, {
lp:LP ->
exists(lp.statuses, {
ps:PS ->
>>>ps.status<<< != null and ps.status.id = statusId
})
}) in...

Maros Bajtos
 
Posts: 145
Joined: Mon Feb 27, 2012 2:52 pm

Re: Null Iterator

Thu Apr 03, 2014 4:27 pm

Matt,

there are some cases when this can really happen. Essentially it means that there is a null value in lp.statuses and thus one of the values passed as an iterator is also null. I expect that you are using shared records and property "statuses" is a relationship, there is only one explanation that occurs to me straight away - when using lists, hibernate will put null objects if the index column is inconsistent - if there are some missing values or the values doesn't start with number 0. So an example would be that you have an instance of LP which is associated with two instances of PS. The DB mapping is specified in such a way that PS has FK to LP and index column (let's say "PS_INDEX"). Now if you select all PS that are associated with the given LP the values of PS_INDEX column should form sequence from 0 to N-1 where N is number of PS instances associated with the given LP. So in the example of one instance of LP and two instances of PS, the index column should contain values 0 and 1.

Quite nice description of what's going on can be found here: http://www.intertech.com/Blog/hibernate ... ollection/

If I did not guessed right, please provide some additional details such as the data model of LP and PS data types and so on.

matt.price
 
Posts: 66
Joined: Thu May 03, 2012 11:51 pm

Re: Null Iterator

Thu Apr 03, 2014 4:38 pm

I'll review with my colleagues and see if that is our problem.

I'm also suspicious about our separate signalling processing which removes a PS from the LP::statuses set. Could there be a chance that the loop has already begun and the iterator is the nulled out by the separate process? Thread safety issue?

Edit: statuses is a Set

matt.price
 
Posts: 66
Joined: Thu May 03, 2012 11:51 pm

Re: Null Iterator

Thu Apr 03, 2014 4:49 pm

To rule out race condition:

If sending a signal synchronously, will the Finish of the catch signal event be processed before the sendSignal function returns?

Maros Bajtos
 
Posts: 145
Joined: Mon Feb 27, 2012 2:52 pm

Re: Null Iterator

Thu Apr 03, 2014 4:57 pm

Is statuses DB relationship? Another generic behaviour of LSPS is that if you have a reference to shared record somewhere in the process and the instance is removed from DB by some other transaction or in other process, LSPS will replace that instance with null next time it loads the process definition. Basically LSPS tries to load the object based on its type and id, but given it doesn't exists anymore, process will not fail but rather resolve the given reference as null.

To answer your latter question: Yes it will. However if in that synchronous processing you remove (delete from DB) some object that you are using in the process which is sending signal then it will be replaced with null value.

matt.price
 
Posts: 66
Joined: Thu May 03, 2012 11:51 pm

Re: Null Iterator

Thu Apr 03, 2014 5:08 pm

We delete in the Finish.

For now we will just have to protect the loop against the possible nulls.

Thanks for the help!

Return to Expression language

Who is online

Users browsing this forum: No registered users and 1 guest