You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by bu...@apache.org on 2004/03/17 15:24:23 UTC

DO NOT REPLY [Bug 27741] New: - in #foreach: if nulls are encountered last value is returned instead of null

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27741>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27741

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

           Summary: in #foreach: if nulls are encountered last value is
                    returned instead of null
           Product: Velocity
           Version: 1.3.1-rc2
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Source
        AssignedTo: velocity-dev@jakarta.apache.org
        ReportedBy: indra@feeddex.nl


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

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org