serge       01/10/25 21:36:39

  Modified:    src/java/org/apache/james/mailrepository
                        AvalonSpoolRepository.java
  Log:
  Don't crash if there's a concurrent modification exception... just start over 
through loop.
  
  Revision  Changes    Path
  1.3       +16 -13    
jakarta-james/src/java/org/apache/james/mailrepository/AvalonSpoolRepository.java
  
  Index: AvalonSpoolRepository.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-james/src/java/org/apache/james/mailrepository/AvalonSpoolRepository.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AvalonSpoolRepository.java        2001/08/06 04:14:13     1.2
  +++ AvalonSpoolRepository.java        2001/10/26 04:36:39     1.3
  @@ -7,6 +7,7 @@
    */
   package org.apache.james.mailrepository;
   
  +import java.util.ConcurrentModificationException;
   import java.util.Iterator;
   import javax.mail.MessagingException;
   import org.apache.james.util.Lock;
  @@ -37,24 +38,26 @@
               getLogger().debug("Method accept() called");
           }
           while (true) {
  -            for(Iterator it = list(); it.hasNext(); ) {
  +            try {
  +                for(Iterator it = list(); it.hasNext(); ) {
   
  -                String s = it.next().toString();
  -                     if (DEEP_DEBUG) {
  -                    getLogger().debug("Found item " + s
  -                                                  + " in spool.");
  -                }
  -                if (lock(s)) {
  -                         if (DEEP_DEBUG) {
  -                        getLogger().debug("accept() has locked: "
  -                                                      + s);
  +                    String s = it.next().toString();
  +                    if (DEEP_DEBUG) {
  +                        getLogger().debug("Found item " + s
  +                                                      + " in spool.");
  +                    }
  +                    if (lock(s)) {
  +                        if (DEEP_DEBUG) {
  +                            getLogger().debug("accept() has locked: "
  +                                                          + s);
  +                        }
  +                        return s;
                       }
  -                    return s;
                   }
  -            }
  -            try {
  +
                   wait();
               } catch (InterruptedException ignored) {
  +            } catch (ConcurrentModificationException ignoredAlso) {
               }
           }
       }
  
  
  

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

Reply via email to