Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@apache.org Received: (qmail 68153 invoked from network); 29 Apr 2003 21:52:09 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 29 Apr 2003 21:52:09 -0000 Received: (qmail 7878 invoked by uid 97); 29 Apr 2003 21:54:14 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-dev@nagoya.betaversion.org Received: (qmail 7871 invoked from network); 29 Apr 2003 21:54:14 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 29 Apr 2003 21:54:14 -0000 Received: (qmail 67224 invoked by uid 500); 29 Apr 2003 21:51:52 -0000 Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Developers List" Reply-To: "Tomcat Developers List" Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 67181 invoked by uid 500); 29 Apr 2003 21:51:51 -0000 Received: (qmail 67178 invoked from network); 29 Apr 2003 21:51:51 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 29 Apr 2003 21:51:51 -0000 Received: (qmail 74374 invoked by uid 1135); 29 Apr 2003 21:51:51 -0000 Date: 29 Apr 2003 21:51:51 -0000 Message-ID: <20030429215151.74373.qmail@icarus.apache.org> From: remm@apache.org To: jakarta-tomcat-catalina-cvs@apache.org Subject: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util Enumerator.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N remm 2003/04/29 14:51:51 Modified: catalina/src/share/org/apache/catalina/util Enumerator.java Log: - Clone the iterator in Session.getAttributeNames to allow the (common) cleanup use case (bug 19103). IMO it is more a spec bug, but ... - Submitted by Tim Funk Revision Changes Path 1.2 +55 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/Enumerator.java Index: Enumerator.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/Enumerator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Enumerator.java 18 Jul 2002 16:47:45 -0000 1.1 +++ Enumerator.java 29 Apr 2003 21:51:51 -0000 1.2 @@ -68,6 +68,8 @@ import java.util.Collection; import java.util.Enumeration; import java.util.Iterator; +import java.util.List; +import java.util.LinkedList; import java.util.Map; import java.util.NoSuchElementException; @@ -101,6 +103,19 @@ /** + * Return an Enumeration over the values of the specified Collection. + * + * @param collection Collection whose values should be enumerated + * @param clone true to clone iterator + */ + public Enumerator(Collection collection, boolean clone) { + + this(collection.iterator(), clone); + + } + + + /** * Return an Enumeration over the values returned by the * specified Iterator. * @@ -115,6 +130,29 @@ /** + * Return an Enumeration over the values returned by the + * specified Iterator. + * + * @param iterator Iterator to be wrapped + * @param clone true to clone iterator + */ + public Enumerator(Iterator iterator, boolean clone) { + + super(); + if (clone) { + this.iterator = iterator; + } else { + List list = new LinkedList(); + while(iterator.hasNext()) { + list.add(iterator.next()); + } + this.iterator = list.iterator(); + } + + } + + + /** * Return an Enumeration over the values of the specified Map. * * @param map Map whose values should be enumerated @@ -122,6 +160,19 @@ public Enumerator(Map map) { this(map.values().iterator()); + + } + + + /** + * Return an Enumeration over the values of the specified Map. + * + * @param map Map whose values should be enumerated + * @param clone true to clone iterator + */ + public Enumerator(Map map, boolean clone) { + + this(map.values().iterator(), clone); } --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org