Permalink
Browse files

When body is an InputStream, ensure it gets closed at the end

  • Loading branch information...
1 parent 88a9791 commit b81fbcab41c1c4a581fcf87dfeb5cec1c05562c6 Marko Topolnik committed with weavejester Nov 21, 2010
Showing with 4 additions and 5 deletions.
  1. +4 −5 ring-servlet/src/ring/util/servlet.clj
View
9 ring-servlet/src/ring/util/servlet.clj
@@ -82,11 +82,10 @@
(.print writer (str chunk))
(.flush writer)))
(instance? InputStream body)
- (let [^InputStream b body]
- (with-open [out (.getOutputStream response)]
- (io/copy b out)
- (.close b)
- (.flush out)))
+ (with-open [out (.getOutputStream response)
+ ^InputStream b body]
+ (io/copy b out)
+ (.flush out))
(instance? File body)
(let [^File f body]
(with-open [stream (FileInputStream. f)]

0 comments on commit b81fbca

Please sign in to comment.