Close output stream

master
Stuart Boston 13 years ago
parent 0ef278e19d
commit 073331cddb

@ -110,6 +110,7 @@ public final class WebBrowser {
BufferedReader in = null; BufferedReader in = null;
URLConnection cnx = null; URLConnection cnx = null;
OutputStreamWriter wr = null;
try { try {
cnx = openProxiedConnection(url); cnx = openProxiedConnection(url);
@ -117,9 +118,8 @@ public final class WebBrowser {
if (jsonBody != null) { if (jsonBody != null) {
cnx.setDoOutput(true); cnx.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(cnx.getOutputStream()); wr = new OutputStreamWriter(cnx.getOutputStream());
wr.write(jsonBody); wr.write(jsonBody);
wr.flush();
} }
readHeader(cnx); readHeader(cnx);
@ -130,6 +130,11 @@ public final class WebBrowser {
content.write(line); content.write(line);
} }
} finally { } finally {
if (wr != null) {
wr.flush();
wr.close();
}
if (in != null) { if (in != null) {
in.close(); in.close();
} }

Loading…
Cancel
Save