Skip to content

Commit

Permalink
Better error handling for NNML files that get deleted before we get t…
Browse files Browse the repository at this point in the history
…o indexing them
  • Loading branch information
marktriggs committed Aug 6, 2011
1 parent d704d05 commit 19be3e5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/net/dishevelled/mailindex/backends/nnml.clj
@@ -1,6 +1,6 @@
(ns net.dishevelled.mailindex.backends.nnml
(:import (java.util Date)
(java.io FileInputStream))
(java.io FileInputStream IOException))
(:require clojure.set)
(:use clojure.java.io))

Expand All @@ -13,10 +13,13 @@
(defn- message-bytes
"Return the bytes of a message."
[^String msg]
(let [out (byte-array (.length (file msg)))]
(with-open [fis (FileInputStream. msg)]
(.read fis out))
out))
(try
(let [out (byte-array (.length (file msg)))]
(with-open [fis (FileInputStream. msg)]
(.read fis out))
out)
(catch IOException _
(byte-array 0))))


(defn- filename-to-id
Expand Down

0 comments on commit 19be3e5

Please sign in to comment.