Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-658

$velocityHasNext does not work in nested loops

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.6, 1.6.1
    • Fix Version/s: 1.7
    • Component/s: Engine
    • Labels:
      None

      Description

      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.

        Attachments

        Issue Links

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              wyla Jarkko Viinamäki

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment