[ https://issues.apache.org/jira/browse/VELOCITY-658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jarkko Viinamäki updated VELOCITY-658: -------------------------------------- Attachment: velocity-hasNext-bug.patch Testcase and a patch that fixes this bug. > $velocityHasNext does not work in nested loops > ---------------------------------------------- > > Key: VELOCITY-658 > URL: https://issues.apache.org/jira/browse/VELOCITY-658 > Project: Velocity > Issue Type: Bug > Components: Engine > Affects Versions: 1.6, 1.6.1 > Reporter: Jarkko Viinamäki > Priority: Minor > Attachments: velocity-hasNext-bug.patch > > > With this test case: > assertEvalEquals("test1 (a1;a2;a3)-test2 (a1;a2;a3)-test3 (a1;a2;a3)-test4 > (a1;a2;a3)", > "#foreach ($value in $list)$value (#foreach ($val in $list2)$val#if( > $velocityHasNext );#end#end)#if( $velocityHasNext )-#end#end"); > Velocity 1.6.1 (or current head) fails because the "hasNext" flag status of > the outer foreach loop gets overwritten by the nested foreach loop. To fix > this we need to save the status of the hasNext flag in Foreach directive just > like we save the value of the counter. > This bug is related to VELOCITY-657 but is a separate bug. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org For additional commands, e-mail: dev-h...@velocity.apache.org