You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2006/10/06 19:14:31 UTC
svn commit: r453686 -
/james/server/branches/v2.3/src/java/org/apache/james/mailrepository/MBoxMailRepository.java
Author: norman
Date: Fri Oct 6 10:14:30 2006
New Revision: 453686
URL: http://svn.apache.org/viewvc?view=rev&rev=453686
Log:
Fix nullpointer if mbox is not created and accessed via pop3. See JAMES-625
Modified:
james/server/branches/v2.3/src/java/org/apache/james/mailrepository/MBoxMailRepository.java
Modified: james/server/branches/v2.3/src/java/org/apache/james/mailrepository/MBoxMailRepository.java
URL: http://svn.apache.org/viewvc/james/server/branches/v2.3/src/java/org/apache/james/mailrepository/MBoxMailRepository.java?view=diff&rev=453686&r1=453685&r2=453686
==============================================================================
--- james/server/branches/v2.3/src/java/org/apache/james/mailrepository/MBoxMailRepository.java (original)
+++ james/server/branches/v2.3/src/java/org/apache/james/mailrepository/MBoxMailRepository.java Fri Oct 6 10:14:30 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 {
@@ -540,10 +541,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