struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark B (JIRA)" <>
Subject [jira] Commented: (WW-3010) s:iterator fails to iterate over collections containing null
Date Thu, 16 Apr 2009 17:12:06 GMT


Mark B commented on WW-3010:

It is generally understood, in the programming world, that users of undocumented "features"
are absolutely free to use said features but that they do so at their own peril.

At worst this is a bug, and should be fixed. 
At best, an "undocumented feature". (And that would be very hard to argue as this is documented
as an iterator, a notion that transcends APIs and programming languages.) 

In any case, when it finally works according to the documentation no good developer should
be surprised, and no well tested or written app should stop working. 

> s:iterator fails to iterate over collections containing null
> ------------------------------------------------------------
>                 Key: WW-3010
>                 URL:
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.14
>         Environment: any
>            Reporter: Daniel Baldes
> When using the struts2 taglib's iterator tag to iterate over a collection which contains
nulls, the current value ("id") is not set to null, but to the value it had in the last iteration
before. This behaviour is explicitly coded without any obvious reason. See
from line 219:
>             if ((id != null) && (currentValue != null)) {
>                 //pageContext.setAttribute(id, currentValue);
>                 //pageContext.setAttribute(id, currentValue, PageContext.REQUEST_SCOPE);
>                 stack.getContext().put(id, currentValue);
>             }
> Expected behaviour: just iterate over the null values as a plain java iterator would.
> If nulls are forbidden for some important reason, it should throw an execption, but not
return a wrong value.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message