Gil Portenseigne created OFBIZ-12816:
----------------------------------------

             Summary: Fix exception for createFuturePeriod Service
                 Key: OFBIZ-12816
                 URL: https://issues.apache.org/jira/browse/OFBIZ-12816
             Project: OFBiz
          Issue Type: Bug
    Affects Versions: Upcoming Branch
            Reporter: Gil Portenseigne
            Assignee: Gil Portenseigne
             Fix For: Upcoming Branch


Exception is thrown when using createFuturePeriod service :
{code:java}
 org.apache.ofbiz.entity.transaction.GenericTransactionException: Roll back 
error, could not commit transaction, was rolled back instead because of: 
Service [createFuturePeriod] threw an unexpected 
exception/errororg.apache.ofbiz.service.GenericServiceException: Error running 
Groovy method [createFuturePeriod] in Groovy file 
[component://common/groovyScripts/CommonServices.groovy]:  (Error while 
checking to see if this is the last result (The 'isLast' method is only allowed 
on scroll cursors.)) (Error running Groovy method [createFuturePeriod] in 
Groovy file [component://common/groovyScripts/CommonServices.groovy]:  (Error 
while checking to see if this is the last result (The 'isLast' method is only 
allowed on scroll cursors.)))
{code}
Indeed `hasNext` is used on `EntityListIterator`, this usage is discourage in 
its javadoc displaying a warning and leading to this exception.

A simple fix is to not test next value presence before getting it, but after..



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to