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

        Indra Polak created issue -
        Jeff Turner made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 27741 12315124
        Henning Schmiedehausen made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12325129 ] Default workflow, editable Closed status [ 12551379 ]
        Mark Thomas made changes -
        Assignee Velocity-Dev List [ velocity-dev@jakarta.apache.org ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12551379 ] jira [ 12552357 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development