[ https://issues.apache.org/jira/browse/OFBIZ-12816?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17719872#comment-17719872 ]
ASF subversion and git services commented on OFBIZ-12816: --------------------------------------------------------- Commit 19e02fea892219406329acddb781474730a85bc2 in ofbiz-framework's branch refs/heads/trunk from Gil Portenseigne [ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=19e02fea89 ] Fixed: Fix exception for createFuturePeriod Service (OFBIZ-12816) Do not use `.hasNext()`, prefer to test with groovy truth the assignment of `.next()` value. If null, it ends the while loop. > 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 > Priority: Trivial > 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)