Skip to content
This repository was archived by the owner on Nov 4, 2020. It is now read-only.

Commit 0512317

Browse files
committed
Make sure to close an input stream
Closing the stream in the called method is not enough because the method might change, or not even be found. Therefore, make sure the stream gets closed; multiple calls to close() on the same stream do not cause an exception, after all. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent abf791b commit 0512317

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/org/eclipsescript/util/JavaUtils.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ public static String readURLConnection(URLConnection uc) throws Exception {
109109
charSet = contentType.substring(charSetNameIndex + 8);
110110
}
111111
InputStream in = uc.getInputStream();
112-
return readAllToStringAndClose(in, charSet);
112+
try {
113+
return readAllToStringAndClose(in, charSet);
114+
} finally {
115+
in.close();
116+
}
113117
}
114118

115119
}

0 commit comments

Comments
 (0)