Skip to content

Commit

Permalink
Make sure the output stream is closed too
Browse files Browse the repository at this point in the history
  • Loading branch information
jhy committed Jul 11, 2021
1 parent 78f4289 commit 607995d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/org/jsoup/helper/HttpConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -858,8 +858,10 @@ else if (methodHasBody)
try {
conn.connect();
if (conn.getDoOutput()) {
try { writePost(req, conn.getOutputStream(), mimeBoundary); }
OutputStream out = conn.getOutputStream();
try { writePost(req, out, mimeBoundary); }
catch (IOException e) { conn.disconnect(); throw e; }
finally { out.close(); }
}

int status = conn.getResponseCode();
Expand Down

0 comments on commit 607995d

Please sign in to comment.