You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacques Le Roux <ja...@les7arts.com> on 2017/06/13 18:00:11 UTC

For performance reasons do not use the EntityListIterator.hasNext()

Hi,

While working on EntityListIterator with try-with-ressources I noticed this message

2017-06-02 11:50:33,328 |jsse-nio-8443-exec-6 |EntityListIterator            |W| For performance reasons do not use the EntityListIterator.hasNext() 
method, just call next() until it returns null; see JavaDoc
  comments in the EntityListIterator class for details and an example
java.lang.Exceptionfbiz
     at org.apache.ofbiz.entity.util.EntityListIterator.hasNext(EntityListIterator.java:254) [ofbiz.jar:?]
   at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2028) [groovy-all-2.4.10.jar:2.4.10]
         at org.codehaus.groovy.runtime.dgm$161.invoke(Unknown Source) [groovy-all-2.4.10.jar:2.4.10]
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274) 
[groovy-all-2.4.10.jar:2.4.10]
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56) [groovy-all-2.4.10.jar:2.4.10]
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) [groovy-all-2.4.10.jar:2.4.10]
         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) [groovy-all-2.4.10.jar:2.4.10]
         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) [groovy-all-2.4.10.jar:2.4.10]
         at OpenOrderItemsReport.run(OpenOrderItemsReport.groovy:92) [script:?]

Do you think it's worth to rewrite in another way the listIt.each closure? I checked there are no other cases.

Jacques