Skip to content

Commit 5daf68f

Browse files
committed
re #VFS-834: ensure resource cleaned up
1 parent e0fc2f2 commit 5daf68f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

commons-vfs2/src/test/java/org/apache/commons/vfs2/AbstractProviderTestCase.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ protected void assertSameContent(final String expected, final FileObject file) t
114114
* are encoded using UTF-8.
115115
*/
116116
protected void assertSameURLContent(final String expected, final URLConnection connection) throws Exception {
117-
assertSameURLContent(expected, connection.getInputStream(), connection);
117+
try (InputStream in = connection.getInputStream()) {
118+
assertSameURLContent(expected, in, connection);
119+
}
118120
}
119121

120122
/**

0 commit comments

Comments
 (0)