Howdy,
I dislike the for-style iteration for collections ;(  I prefer the
while(...) rather than something like
for (Enumeration e = ht.keys(); e.hasMoreElements() && (misses <= 4); )

which to me is hard to read... But to each his/her own ;)

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Tim Emiola [mailto:[EMAIL PROTECTED]
>Sent: Friday, October 17, 2003 4:26 AM
>To: Log4J Developers List
>Subject: Re: Patch fix for Bug 23705 (Parser gets confused when using
>external entities.)
>
>The patch file aslo contains fixes for Bug #22339
>(Tiger) enum is a keyword.
>
>--- Tim Emiola <[EMAIL PROTECTED]> wrote:
>> I have modified DOMConfigurator and
>> Log4jEntityResolver, and added a new testcase to
>> demonstrate that the problem is fixed.
>>
>> Hope this is useful,
>> Tim
>>
>> __________________________________
>> Do you Yahoo!?
>> The New Yahoo! Shopping - with improved product
>> search
>> http://shopping.yahoo.com> Index:
>src/java/org/apache/log4j/Category.java
>>
>===================================================================
>> RCS file:
>>
>/home/cvspublic/jakarta-log4j/src/java/org/apache/log4j/Category.java,v
>> retrieving revision 1.77
>> diff -u -r1.77 Category.java
>> --- src/java/org/apache/log4j/Category.java  23 Aug
>> 2003 16:00:52 -0000  1.77
>> +++ src/java/org/apache/log4j/Category.java  17 Oct
>> 2003 07:39:23 -0000
>> @@ -272,15 +272,11 @@
>>     * @since 1.0
>>     */
>>    void closeNestedAppenders() {
>> -    Enumeration enum = this.getAllAppenders();
>> -
>> -    if (enum != null) {
>> -      while (enum.hasMoreElements()) {
>> -        Appender a = (Appender) enum.nextElement();
>> -
>> -        if (a instanceof AppenderAttachable) {
>> -          a.close();
>> -        }
>> +    for (Enumeration e = this.getAllAppenders();
>> +        (e != null) && (e.hasMoreElements()); ) {
>> +      Appender a = (Appender) e.nextElement();
>> +      if (a instanceof AppenderAttachable) {
>> +        a.close();
>>        }
>>      }
>>    }
>> Index: src/java/org/apache/log4j/NDC.java
>>
>===================================================================
>> RCS file:
>>
>/home/cvspublic/jakarta-log4j/src/java/org/apache/log4j/NDC.java,v
>> retrieving revision 1.16
>> diff -u -r1.16 NDC.java
>> --- src/java/org/apache/log4j/NDC.java       23 Aug 2003
>> 16:00:52 -0000       1.16
>> +++ src/java/org/apache/log4j/NDC.java       17 Oct 2003
>> 07:39:24 -0000
>> @@ -265,15 +265,13 @@
>>        int misses = 0;
>>        v = new Vector();
>>
>> -      Enumeration enum = ht.keys();
>> -
>>        // We give up after 4 straigt missses. That
>> is 4 consecutive
>>        // inspected threads in 'ht' that turn out to
>> be alive.
>>        // The higher the proportion on dead threads
>> in ht, the higher the
>>        // chances of removal.
>> -      while (enum.hasMoreElements() && (misses <=
>> 4)) {
>> -        Thread t = (Thread) enum.nextElement();
>> -
>> +      for (Enumeration e = ht.keys();
>> +          e.hasMoreElements() && (misses <= 4); )
>> {
>> +        Thread t = (Thread) e.nextElement();
>>          if (t.isAlive()) {
>>            misses++;
>>          } else {
>> Index:
>> src/java/org/apache/log4j/PropertyConfigurator.java
>>
>===================================================================
>> RCS file:
>>
>/home/cvspublic/jakarta-
>log4j/src/java/org/apache/log4j/PropertyConfigurator.java,v
>> retrieving revision 1.60
>> diff -u -r1.60 PropertyConfigurator.java
>> ---
>> src/java/org/apache/log4j/PropertyConfigurator.java
>> 17 Sep 2003 16:03:02 -0000   1.60
>> +++
>> src/java/org/apache/log4j/PropertyConfigurator.java
>> 17 Oct 2003 07:39:24 -0000
>> @@ -541,10 +541,9 @@
>>    */
>>    protected void parseCatsAndRenderers(
>>      Properties props, LoggerRepository hierarchy) {
>> -    Enumeration enum = props.propertyNames();
>>
>> -    while (enum.hasMoreElements()) {
>> -      String key = (String) enum.nextElement();
>> +    for (Enumeration e = props.propertyNames();
>> e.hasMoreElements();) {
>> +      String key = (String) e.nextElement();
>>
>>        if (key.startsWith(CATEGORY_PREFIX) ||
>> key.startsWith(LOGGER_PREFIX)) {
>>          String loggerName = null;
>> Index:
>>
>src/java/org/apache/log4j/jmx/LoggerDynamicMBean.java
>>
>===================================================================
>> RCS file:
>>
>/home/cvspublic/jakarta-
>log4j/src/java/org/apache/log4j/jmx/LoggerDynamicMBean.java,v
>> retrieving revision 1.3
>> diff -u -r1.3 LoggerDynamicMBean.java
>> ---
>>
>src/java/org/apache/log4j/jmx/LoggerDynamicMBean.java
>> 18 Mar 2003 13:33:33 -0000   1.3
>> +++
>>
>src/java/org/apache/log4j/jmx/LoggerDynamicMBean.java
>> 17 Oct 2003 07:39:25 -0000
>> @@ -228,9 +228,9 @@
>>    }
>>
>>    void appenderMBeanRegistration() {
>> -    Enumeration enum = logger.getAllAppenders();
>> -    while(enum.hasMoreElements()) {
>> -      Appender appender = (Appender)
>> enum.nextElement();
>> +    for (Enumeration e = logger.getAllAppenders();
>> +        e != null && e.hasMoreElements(); ) {
>> +      Appender appender = (Appender)
>> e.nextElement();
>>        registerAppenderMBean(appender);
>>      }
>>    }
>> Index:
>>
>src/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeEdito
r.ja
>va
>>
>===================================================================
>> RCS file:
>>
>/home/cvspublic/jakarta-
>log4j/src/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNod
eEdi
>tor.java,v
>> retrieving revision 1.1
>> diff -u -r1.1 CategoryNodeEditor.java
>> ---
>>
>src/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeEdito
r.ja
>va
>> 26 Apr 2002 15:48:43 -0000   1.1
>> +++
>>
>src/java/org/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeEdito
r.ja
>va
>> 17 Oct 2003 07:39:26 -0000
>> @@ -241,9 +241,10 @@
>>    protected int removeUnusedNodes() {
>>      int count = 0;
>>      CategoryNode root =
>> _categoryModel.getRootCategoryNode();
>> -    Enumeration enum =
>> root.depthFirstEnumeration();
>> -    while (enum.hasMoreElements()) {
>> -      CategoryNode node = (CategoryNode)
>> enum.nextElement();
>> +
>> +    for (Enumeration e =
>> root.depthFirstEnumeration();
>> +        e.hasMoreElements(); ) {
>> +      CategoryNode node = (CategoryNode)
>> e.nextElement();
>>        if (node.isLeaf() &&
>> node.getNumberOfContainedRecords() == 0
>>            && node.getParent() != null) {
>>          _categoryModel.removeNodeFromParent(node);
>> Index:
>> src/java/org/apache/log4j/net/SocketReceiver.java
>>
>===================================================================
>> RCS file:
>>
>/home/cvspublic/jakarta-
>log4j/src/java/org/apache/log4j/net/SocketReceiver.java,v
>> retrieving revision 1.5
>> diff -u -r1.5 SocketReceiver.java
>> ---
>> src/java/org/apache/log4j/net/SocketReceiver.java    24
>> Jun 2003 08:21:52 -0000      1.5
>> +++
>> src/java/org/apache/log4j/net/SocketReceiver.java    17
>> Oct 2003 07:39:26 -0000
>> @@ -305,8 +305,8 @@
>>    public Vector getConnectedSocketDetails() {
>>      Vector details = new Vector(socketList.size());
>>
>> -    for (Enumeration enum = socketList.elements();
>> enum.hasMoreElements();) {
>> -      Socket socket = (Socket) enum.nextElement();
>> +    for (Enumeration e = socketList.elements();
>> e.hasMoreElements();) {
>> +      Socket socket = (Socket) e.nextElement();
>>        details.add(
>>          new SocketDetail(socket, (SocketNode)
>> socketMap.get(socket)));
>>      }
>> Index: src/java/org/apache/log4j/test/Finalize.java
>>
>===================================================================
>> RCS file:
>>
>/home/cvspublic/jakarta-
>log4j/src/java/org/apache/log4j/test/Finalize.java,v
>> retrieving revision 1.4
>> diff -u -r1.4 Finalize.java
>> --- src/java/org/apache/log4j/test/Finalize.java     5
>> May 2003 20:42:58 -0000      1.4
>> +++ src/java/org/apache/log4j/test/Finalize.java     17
>> Oct 2003 07:39:27 -0000
>> @@ -69,9 +69,9 @@
>>
>>    static
>>    void foo(Category cat) {
>> -    Enumeration enum = cat.getAllAppenders();
>> -    while(enum != null && enum.hasMoreElements()) {
>> -      ((org.apache.log4j.Appender)
>> enum.nextElement()).close();
>> +    for (Enumeration e = cat.getAllAppenders();
>> +        e != null && e.hasMoreElements();) {
>>
>=== message truncated ===>
>---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> [EMAIL PROTECTED]
>> For additional commands, e-mail:
>[EMAIL PROTECTED]
>
>
>__________________________________
>Do you Yahoo!?
>The New Yahoo! Shopping - with improved product search
>http://shopping.yahoo.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to