EntityListIterator Not Closed Error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

EntityListIterator Not Closed Error

vivek
Dear Friends,

Greetings of the day.

I am working on a request to display latest 5 pending reviews in one particular section of the website.
For this reason i have written entity-condition in the actions section of the screen.
However i can make use of groovy or ftl itself & call the list out there, but wish to perform in this way.

The concern i am facing is that when the list gets prepared, it is throwing EntityListIterator error stating
 EntityListIterator Not Closed for Entity [ProductReview], caught in Finalize

Here is the attached code what i am trying to do.

<entity-condition entity-name="ProductReview" list-name="productReviewList">
        <condition-expr field-name="statusId" operator="equals" value="PRR_PENDING"/>
        <select-field field-name="productRating"/>
        <select-field field-name="productReview"/>
        <select-field field-name="postedAnonymous"/>
        <select-field field-name="userLoginId"/>
        <select-field field-name="postedDateTime"/>
        <order-by field-name="productReviewId"/>
        <limit-range start="0" size="5"/>
</entity-condition>


As it observed there should be an object of EntityListIterator say eli which must be closed (eli.close()). However the same thing in groovy or java with eli.close() works fine, but I am unaware as how to write the said expression in xml or is there any other way around to prevent the concern i am facing.

i have attached an file containing the same code, if in case the code gets messy while posting.

Kindly let me know what can be done in the process to rectify the concern or how can i avoid the error being encountered?

Your early reply & help in this regard will be highly appreciated.

Thanks.

Regards:-

Vivek Jadiya
er.jadiyavivek@gmail.com
+91-9686757747code.txt
Kind Regards,
Vivek J
Reply | Threaded
Open this post in threaded view
|

Re: EntityListIterator Not Closed Error

Paul Foxworthy
Hello Vivek,

Are you consuming your productReviewList anywhere? That might be what frees up the iterator.

See for example the screen EditContactListParty in applications/marketing/widget/ContactListScreens.xml at https://fisheye6.atlassian.com/browse/ofbiz/trunk/applications/marketing/widget/ContactListScreens.xml?hb=true#to129
There's an iterate-section using the list defined by the entity-condition.

I haven't tested it, but if the EditContactListParty doesn't bring on the problem you're seeing, you might be able to narrow down the difference between it and your code. If it does produce the same error, maybe a bug has crept into the entity-condition action.

Cheers

Paul Foxworthy

vivek wrote
Dear Friends,

Greetings of the day.

I am working on a request to display latest 5 pending reviews in one particular section of the website.
For this reason i have written entity-condition in the actions section of the screen.
However i can make use of groovy or ftl itself & call the list out there, but wish to perform in this way.

The concern i am facing is that when the list gets prepared, it is throwing EntityListIterator error stating
 EntityListIterator Not Closed for Entity [ProductReview], caught in Finalize

Here is the attached code what i am trying to do.

<entity-condition entity-name="ProductReview" list-name="productReviewList">
        <condition-expr field-name="statusId" operator="equals" value="PRR_PENDING"/>
        <select-field field-name="productRating"/>
        <select-field field-name="productReview"/>
        <select-field field-name="postedAnonymous"/>
        <select-field field-name="userLoginId"/>
        <select-field field-name="postedDateTime"/>
        <order-by field-name="productReviewId"/>
        <limit-range start="0" size="5"/>
</entity-condition>


As it observed there should be an object of EntityListIterator say eli which must be closed (eli.close()). However the same thing in groovy or java with eli.close() works fine, but I am unaware as how to write the said expression in xml or is there any other way around to prevent the concern i am facing.

i have attached an file containing the same code, if in case the code gets messy while posting.

Kindly let me know what can be done in the process to rectify the concern or how can i avoid the error being encountered?

Your early reply & help in this regard will be highly appreciated.

Thanks.

Regards:-

Vivek Jadiya
er.jadiyavivek@gmail.com
+91-9686757747code.txt
--
Coherent Software Australia Pty Ltd
http://www.coherentsoftware.com.au/

Bonsai ERP, the all-inclusive ERP system
http://www.bonsaierp.com.au/
Reply | Threaded
Open this post in threaded view
|

Re: EntityListIterator Not Closed Error

vivek
Dear Paul,

Thanks for replying.

I have checked the link provided by you.
I had even investigated & found that the concern arises when i try to filter the number of rows as output.
If i use
<limit-range start="0" size="5"/> 
or
<limit-view view-size="0" view-index="10"/>.

Any suggestion on this?

Thanks
Kind Regards,
Vivek J
Reply | Threaded
Open this post in threaded view
|

Re: EntityListIterator Not Closed Error

Paul Foxworthy
Hi Vivek,

I've tried to understand the code, and I think when you choose limit-range it's getting to this point:

https://fisheye6.atlassian.com/browse/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java?hb=true#to371

The next line closes the entity list iterator.

Is there any exception occurring that stops the close from occurring?

Is the problem associated with a situation where there's *less* than five items?

Cheers

Paul Foxworthy

vivek wrote
Dear Paul,

Thanks for replying.

I have checked the link provided by you.
I had even investigated & found that the concern arises when i try to filter the number of rows as output.
If i use
<limit-range start="0" size="5"/> 
or
<limit-view view-size="0" view-index="10"/>.

Any suggestion on this?

Thanks
--
Coherent Software Australia Pty Ltd
http://www.coherentsoftware.com.au/

Bonsai ERP, the all-inclusive ERP system
http://www.bonsaierp.com.au/
Reply | Threaded
Open this post in threaded view
|

Re: EntityListIterator Not Closed Error

vivek
Dear paul,

Thanks for your reply.

Yes i think indeed the problem is associated with a situation where there's *less* than five items.
But i hope that should not be a concern, as you never know how many items will be there in the list for the first time & as soon as the code is run, it triggers exception as said earlier.

Still unable to figure it out, how can this be evaded. If in Java we might have written conditional limit by checking the count of the entity, but how in XML am i gonna do this, however it was just a guess.
like if (count >5)
get first 5
else get all.

Any further suggestion on this?

Thanks
Kind Regards,
Vivek J