Plug an `InputStream` resource leak

This commit is contained in:
Ben Liblit 2017-08-16 16:42:06 -05:00 committed by Manu Sridharan
parent 8541d67a14
commit e1010439d1
1 changed files with 3 additions and 2 deletions

View File

@ -117,8 +117,9 @@ public class NodejsRequiredSourceModule extends SourceFileModule {
}
private static String loadWrapperSource(String filename) throws IOException {
InputStream url = NodejsRequiredSourceModule.class.getClassLoader().getResourceAsStream(filename);
return new String(Streams.inputStream2ByteArray(url));
try (final InputStream url = NodejsRequiredSourceModule.class.getClassLoader().getResourceAsStream(filename)) {
return new String(Streams.inputStream2ByteArray(url));
}
}
/**