james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r453684 - /james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java
Date Fri, 06 Oct 2006 17:12:10 GMT
Author: norman
Date: Fri Oct  6 10:12:09 2006
New Revision: 453684

URL: http://svn.apache.org/viewvc?view=rev&rev=453684
Log:
Fix nullpointer if mbox is not created and accessed via pop3. See JAMES-625

Modified:
    james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java

Modified: james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java?view=diff&rev=453684&r1=453683&r2=453684
==============================================================================
--- james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/mailrepository/MBoxMailRepository.java Fri
Oct  6 10:12:09 2006
@@ -483,6 +483,7 @@
             //System.out.println("Done Load keys!");
         } catch (FileNotFoundException e) {
             getLogger().error("Unable to save(open) file (File not found) " + mboxFile, e);
+            this.mList = new Hashtable((int)DEFAULTMLISTCAPACITY);
         } catch (IOException e) {
             getLogger().error("Unable to write file (General I/O problem) " + mboxFile, e);
         } finally {
@@ -539,10 +540,13 @@
      */
     public Iterator list() {
         loadKeys();
-        // find the first message.  This is a trick to make sure that if
-        // the file is changed out from under us, we will detect it and
-        // correct for it BEFORE we return the iterator.
-        findMessage((String) mList.keySet().iterator().next());
+        
+        if (mList.keySet().isEmpty() == false) {
+            // find the first message.  This is a trick to make sure that if
+            // the file is changed out from under us, we will detect it and
+            // correct for it BEFORE we return the iterator.
+            findMessage((String) mList.keySet().iterator().next());
+        }
         if ((DEEP_DEBUG) && (getLogger().isDebugEnabled())) {
             StringBuffer logBuffer =
                     new StringBuffer(128)



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message