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 20:07:19 UTC
[jira] Closed: (STR-472) logic:iterate doesn't accept primitive
values
[ http://issues.apache.org/struts/browse/STR-472?page=all ]
David Evans closed STR-472:
---------------------------
Resolution: Fixed
> logic:iterate doesn't accept primitive values
> ---------------------------------------------
>
> Key: STR-472
> URL: http://issues.apache.org/struts/browse/STR-472
> Project: Struts Action 1
> Type: Improvement
> Components: Taglibs
> Versions: Nightly Build
> Environment: Operating System: All
> Platform: All
> Reporter: Martin Rose
> Assignee: Craig McClanahan
> Priority: Minor
> Fix For: 1.1 Family
> Attachments: primitiveIterate.diff
>
> The struts logic:iterate tag doesn't except arrays of primitives to iterate
> over. I've included a relatively simple patch that allows this, and makes the
> logic:iterate tag much more intuitive and complete as it will handle
> collections and arrays of anything appropriately.
> Could a person with access to the tree PLEASE COMMENT on this to me either
> publically or privately, as I would like to do my best to see this included in
> the 1.1.x release.
> --- jakarta-struts-1.0.1-
> src/src/share/org/apache/struts/taglib/logic/IterateTag.java Wed Jun 13
> 22:24:28 2001
> +++ jakarta-struts-1.0.1-src-
> mfr/src/share/org/apache/struts/taglib/logic/IterateTag.java Thu Jan 31
> 09:31:30 2002
> @@ -310,9 +310,15 @@
> // Construct an iterator for this collection
> - if (collection.getClass().isArray())
> - collection = Arrays.asList((Object[]) collection);
> - if (collection instanceof Collection)
> + if (collection.getClass().isArray()) {
> + int length = java.lang.reflect.Array.getLength(collection);
> + Collection c = new ArrayList();
> + for(int i=0; i<length; i++) {
> + c.add(java.lang.reflect.Array.get(collection, i));
> + }
> + iterator = c.iterator();
> + }
> + else if (collection instanceof Collection)
> iterator = ((Collection) collection).iterator();
> else if (collection instanceof Iterator)
> iterator = (Iterator) collection;
--
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