Skip to content

Commit f04a2e9

Browse files
committed
Sonarqube: Use try-with-resources or close this "InputStream" in a "finally" clause
1 parent e9c3dc4 commit f04a2e9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/zipimporter/ZipImporterBuiltins.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,7 @@ public PBytes doit(PZipImporter self, String pathname) {
466466
long streamPosition = (long) tocEntry.getArray()[6];
467467
ZipInputStream zis = null;
468468
TruffleFile tfile = getContext().getEnv().getTruffleFile(archive);
469-
try {
470-
InputStream in = tfile.newInputStream(StandardOpenOption.READ);
469+
try (InputStream in = tfile.newInputStream(StandardOpenOption.READ)) {
471470
in.skip(streamPosition); // we can fast skip bytes, because there is cached position
472471
// of the zip entry
473472
zis = new ZipInputStream(in);

0 commit comments

Comments
 (0)