minor fixup to FileBasedMailbox
authoradam <adam@megacz.com>
Fri, 22 Oct 2004 00:09:12 +0000 (00:09 +0000)
committeradam <adam@megacz.com>
Fri, 22 Oct 2004 00:09:12 +0000 (00:09 +0000)
darcs-hash:20041022000912-5007d-6bcd45a370b17d0b3438605582ed53def092fc2f.gz

src/org/ibex/mail/target/FileBasedMailbox.java

index 10dd7f9..ae42112 100644 (file)
@@ -160,7 +160,9 @@ public class FileBasedMailbox extends Mailbox.Default implements Serializable {
         public Message cur() {
             if (done()) return null;
             try {
-                File file = new File(entry().path);
+                String where = entry().path;
+                if (!new File(where).exists()) where = where.substring(0, where.lastIndexOf('.')+1);
+                File file = new File(where);
                 FileInputStream fis = null;
                 try {
                     fis = new FileInputStream(file);
@@ -182,7 +184,7 @@ public class FileBasedMailbox extends Mailbox.Default implements Serializable {
             prevayler.execute(new Transaction() {
                     public void executeOn(Object c, Date d) {
                             new File(entry.path).delete();
-                            cache.remove(entry);
+                            if (cache.contains(entry)) { cache.remove(entry); }
                     }});
        }
     }