Velocity
  1. Velocity
  2. VELOCITY-254

in #foreach: if nulls are encountered last value is returned instead of null

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: None
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      Operating System: All
      Platform: PC

      Description

      I put an object having a method that returns an array of Integers in the context
      with contents
      [100,100,NULL,NULL,...]
      Then looping over the contents using
      #foreach ($elt in $Object.List) $!elt #end

      ALL entries become 100 with output:
      100 100 100 100 (...)
      instead of the expected
      100 100

      When converting all null objects to say new Integer(0) in the
      getList() body before returning the list, output becomes
      100 100 0 0 0 0 0

      Apparently null values are not treated as first citizens,

      Cheers,

      Indra

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Indra Polak
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development