dgraham 2003/01/31 21:12:25 Modified: src/share/org/apache/struts/taglib/html OptionsCollectionTag.java OptionsTag.java src/share/org/apache/struts/taglib/logic IterateTag.java Log: Replaced IteratorAdaptor references with commons-collections' IteratorUtils.asIterator(Enumeration) Revision Changes Path 1.8 +10 -4 jakarta-struts/src/share/org/apache/struts/taglib/html/OptionsCollectionTag.java Index: OptionsCollectionTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/OptionsCollectionTag.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- OptionsCollectionTag.java 4 Oct 2002 05:34:19 -0000 1.7 +++ OptionsCollectionTag.java 1 Feb 2003 05:12:24 -0000 1.8 @@ -1,9 +1,13 @@ /* + * $Header$ + * $Revision$ + * $Date$ + * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,10 +67,12 @@ import java.util.Enumeration; import java.util.Iterator; import java.util.Map; + import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.TagSupport; + import org.apache.commons.beanutils.PropertyUtils; -import org.apache.struts.util.IteratorAdapter; +import org.apache.commons.collections.IteratorUtils; import org.apache.struts.util.MessageResources; import org.apache.struts.util.RequestUtils; import org.apache.struts.util.ResponseUtils; @@ -399,7 +405,7 @@ else if (collection instanceof Map) return (((Map)collection).entrySet().iterator()); else if (collection instanceof Enumeration) - return(new IteratorAdapter((Enumeration)collection)); + return IteratorUtils.asIterator((Enumeration)collection); else throw new JspException( messages.getMessage("optionsCollectionTag.iterator", 1.21 +34 -24 jakarta-struts/src/share/org/apache/struts/taglib/html/OptionsTag.java Index: OptionsTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/OptionsTag.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- OptionsTag.java 16 Dec 2002 03:41:43 -0000 1.20 +++ OptionsTag.java 1 Feb 2003 05:12:25 -0000 1.21 @@ -1,9 +1,13 @@ /* + * $Header$ + * $Revision$ + * $Date$ + * * ==================================================================== * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,10 +67,12 @@ import java.util.Enumeration; import java.util.Iterator; import java.util.Map; + import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.TagSupport; + import org.apache.commons.beanutils.PropertyUtils; -import org.apache.struts.util.IteratorAdapter; +import org.apache.commons.collections.IteratorUtils; import org.apache.struts.util.MessageResources; import org.apache.struts.util.RequestUtils; import org.apache.struts.util.ResponseUtils; @@ -128,11 +134,11 @@ protected String labelName = null; public String getLabelName() { - return labelName; + return labelName; } public void setLabelName(String labelName) { - this.labelName = labelName; + this.labelName = labelName; } /** @@ -141,11 +147,11 @@ protected String labelProperty = null; public String getLabelProperty() { - return labelProperty; + return labelProperty; } public void setLabelProperty(String labelProperty) { - this.labelProperty = labelProperty; + this.labelProperty = labelProperty; } /** @@ -154,11 +160,11 @@ protected String name=null; public String getName() { - return name; + return name; } public void setName(String name) { - this.name = name; + this.name = name; } @@ -168,11 +174,11 @@ protected String property=null; public String getProperty() { - return property; + return property; } public void setProperty(String property) { - this.property = property; + this.property = property; } @@ -441,21 +447,25 @@ } // Construct and return an appropriate iterator - if (collection.getClass().isArray()) - collection = Arrays.asList((Object[]) collection); - if (collection instanceof Collection) - return (((Collection) collection).iterator()); - else if (collection instanceof Iterator) - return ((Iterator) collection); - else if (collection instanceof Map) - return (((Map) collection).entrySet().iterator()); - else if (collection instanceof Enumeration) - return( new IteratorAdapter((Enumeration)collection)); - else - throw new JspException - (messages.getMessage("optionsTag.iterator", - collection.toString())); + if (collection.getClass().isArray()) { + collection = Arrays.asList((Object[]) collection); + } + if (collection instanceof Collection) { + return (((Collection) collection).iterator()); + + } else if (collection instanceof Iterator) { + return ((Iterator) collection); + + } else if (collection instanceof Map) { + return (((Map) collection).entrySet().iterator()); + + } else if (collection instanceof Enumeration) { + return IteratorUtils.asIterator((Enumeration) collection); + + } else { + throw new JspException(messages.getMessage("optionsTag.iterator", collection.toString())); + } } } 1.19 +9 -7 jakarta-struts/src/share/org/apache/struts/taglib/logic/IterateTag.java Index: IterateTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/logic/IterateTag.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- IterateTag.java 18 Dec 2002 07:06:17 -0000 1.18 +++ IterateTag.java 1 Feb 2003 05:12:25 -0000 1.19 @@ -7,7 +7,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -70,9 +70,11 @@ import java.util.Enumeration; import java.util.Iterator; import java.util.Map; + import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.BodyTagSupport; -import org.apache.struts.util.IteratorAdapter; + +import org.apache.commons.collections.IteratorUtils; import org.apache.struts.util.MessageResources; import org.apache.struts.util.RequestUtils; import org.apache.struts.util.ResponseUtils; @@ -329,7 +331,7 @@ else if (collection instanceof Map) iterator = ((Map) collection).entrySet().iterator(); else if (collection instanceof Enumeration) - iterator = new IteratorAdapter((Enumeration)collection); + iterator = IteratorUtils.asIterator((Enumeration)collection); else { JspException e = new JspException (messages.getMessage("iterate.iterator"));
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]