Browse files

wrap input-stream into with-open

  • Loading branch information...
1 parent 46c63d4 commit eba96bdeea3140823cc440896d2f6f360cb7c4b5 @alexott committed May 2, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/tika.clj
View
6 src/tika.clj
@@ -42,17 +42,17 @@
(extend-protocol TikaProtocol
java.io.File
- (parse [^File file] (parse (input-stream file)))
+ (parse [^File file] (with-open [is (input-stream file)] (parse is)))
(detect-mime-type [^File file] (.detect tika-class file)))
(extend-protocol TikaProtocol
String
- (parse [^String filename] (parse (input-stream filename)))
+ (parse [^String filename] (with-open [is (input-stream filename)] (parse is)))
(detect-mime-type [^String filename] (.detect tika-class filename)))
(extend-protocol TikaProtocol
URL
- (parse [^URL url] (parse (input-stream url)))
+ (parse [^URL url] (with-open [is (input-stream url)] (parse is)))
(detect-mime-type [^URL url] (.detect tika-class url)))
(defn detect-language

0 comments on commit eba96bd

Please sign in to comment.