You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by "David Evans (JIRA)" <ji...@apache.org> on 2006/04/27 19:54:19 UTC

[jira] Reopened: (STR-54) IterateTag fails on null elements

     [ http://issues.apache.org/struts/browse/STR-54?page=all ]
     
David Evans reopened STR-54:
----------------------------


> IterateTag fails on null elements
> ---------------------------------
>
>          Key: STR-54
>          URL: http://issues.apache.org/struts/browse/STR-54
>      Project: Struts Action 1
>         Type: Bug

>   Components: Taglibs
>     Versions: 1.0 Beta 1
>  Environment: Operating System: All
> Platform: PC
>     Reporter: Howard Moore
>     Assignee: Craig McClanahan
>      Fix For: 1.0.0

>
> If the Collection or array used by an IterateTag contains a null value an 
> exception is thrown when the tag attempts to write it into the PageContext. The 
> alternative would be to remove the attribute if it were null and use 
> <logic:present ...> to test for it (see included diff). 
> --- D:\Iterat~1.old	Fri Feb 23 14:36:34 2001
> +++ D:\Iterat~1.java	Mon Feb 26 09:39:22 2001
> @@ -330,7 +330,10 @@
>  	// Store the first value and evaluate, or skip the body if none
>  	if (iterator.hasNext()) {
>  	    Object element = iterator.next();
> -	    pageContext.setAttribute(id, element);
> +	    if (element == null)
> +	        pageContext.removeAttribute(id);
> +	    else
> +	        pageContext.setAttribute(id, element);
>  	    lengthCount++;
>  	    return (EVAL_BODY_TAG);
>          } else
> @@ -358,7 +361,10 @@
>  	    return (SKIP_BODY);
>  	if (iterator.hasNext()) {
>  	    Object element = iterator.next();
> -	    pageContext.setAttribute(id, element);
> +	    if (element == null)
> +	        pageContext.removeAttribute(id);
> +	    else
> +	        pageContext.setAttribute(id, element);
>  	    lengthCount++;
>  	    return (EVAL_BODY_TAG);
>  	} else

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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