Skip to content

Commit cca9a7b

Browse files
committed
close writer even if (.write) call throws
1 parent f2617b3 commit cca9a7b

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

ring-core-protocols/src/ring/core/protocols.clj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,9 @@
5353
(.close)))
5454
clojure.lang.ISeq
5555
(write-body-to-stream [body response output-stream]
56-
(let [writer (response-writer response output-stream)]
56+
(with-open [writer (response-writer response output-stream)]
5757
(doseq [chunk body]
58-
(.write writer (str chunk)))
59-
(.close writer)))
58+
(.write writer (str chunk)))))
6059
java.io.InputStream
6160
(write-body-to-stream [body _ ^OutputStream output-stream]
6261
(with-open [body body]

0 commit comments

Comments
 (0)