Skip to content

[Bug]: Resource leaks detected in sootup.java.bytecode and sootup.core module #1032

@Bryce7832

Description

@Bryce7832

What happened?

Ran the Resource Leak Checker and detected various resource leaks in both sootup.java.bytecode and sootup.core module.

Version

Latest develop branch

Relevant log output

sootup.core/src/main/java/sootup/core/util/Utils.java:[105,30] 
error: [required.method.not.called] @MustCall method close may not have been invoked on fileManager or any of its aliases.
[ERROR]   The type of object is: javax.tools.StandardJavaFileManager.
[ERROR]   Reason for going out of scope: possible exceptional exit due to throw new IllegalArgumentException("could not compile source file."); with exception type java.lang.IllegalArgumentException

sootup.java.bytecode/src/main/java/sootup/java/bytecode/inputlocation/MultiReleaseJarAnalysisInputLocation.java:[209,22] error: [required.method.not.called] @MustCall method close may not have been invoked on inputStream or any of its aliases.
[ERROR]   The type of object is: java.io.FileInputStream.
[ERROR]   Reason for going out of scope: possible exceptional exit due to new JarInputStream(inputStream) with exception type java.io.IOException

sootup.java.bytecode/src/main/java/sootup/java/bytecode/inputlocation/PathBasedAnalysisInputLocation.java:[378,20] error: [required.method.not.called] @MustCall method close may not have been invoked on Files.walk(libDir) or any of its aliases.
[ERROR]   The type of object is: java.util.stream.Stream<java.nio.file.Path>.
[ERROR]   Reason for going out of scope: regular method exit

sootup.java.bytecode/src/main/java/sootup/java/bytecode/inputlocation/PathBasedAnalysisInputLocation.java:[445,68] error: [required.method.not.called] @MustCall method close may not have been invoked on Files.newInputStream(warFilePath) or any of its aliases.
[ERROR]   The type of object is: java.io.InputStream.
[ERROR]   Reason for going out of scope: possible exceptional exit due to zis.getNextEntry() with exception type java.io.IOException

sootup.java.bytecode/src/main/java/sootup/java/bytecode/inputlocation/PathBasedAnalysisInputLocation.java:[461,62] error: [required.method.not.called] @MustCall method close may not have been invoked on Files.newInputStream(file.toPath()) or any of its aliases.
[ERROR]   The type of object is: java.io.InputStream.
[ERROR]   Reason for going out of scope: possible exceptional exit due to zis.read(incomingValues) with exception type java.io.IOException

sootup.java.bytecode/src/main/java/sootup/java/bytecode/inputlocation/PathBasedAnalysisInputLocation.java:[487,64] error: [required.method.not.called] @MustCall method close may not have been invoked on Files.newOutputStream(file.toPath()) or any of its aliases.
[ERROR]   The type of object is: java.io.OutputStream.
[ERROR]   Reason for going out of scope: possible exceptional exit due to zis.read(incomingValues) with exception type java.io.IOException

sootup.java.bytecode/src/main/java/sootup/java/bytecode/inputlocation/OTFCompileAnalysisInputLocation.java:[182,30] error: [required.method.not.called] @MustCall method close may not have been invoked on fileManager or any of its aliases.
[ERROR]   The type of object is: javax.tools.StandardJavaFileManager.
[ERROR]   Reason for going out of scope: possible exceptional exit due to fileManager.setLocation(StandardLocation.CLASS_OUTPUT, Collections.singleton(binDir)) with exception type java.io.IOException

sootup.java.bytecode/src/main/java/sootup/java/bytecode/inputlocation/ModuleFinder.java:[283,14] error: [required.method.not.called] @MustCall method close may not have been invoked on jar or any of its aliases.
[ERROR]   The type of object is: java.util.jar.JarFile.
[ERROR]   Reason for going out of scope: regular method exit

sootup.java.bytecode/src/main/java/sootup/java/bytecode/inputlocation/ModuleFinder.java:[288,59] error: [required.method.not.called] @MustCall method close may not have been invoked on jar.getInputStream(entry) or any of its aliases.
[ERROR]   The type of object is: java.io.InputStream.
[ERROR]   Reason for going out of scope: possible exceptional exit due to new Manifest(jar.getInputStream(entry)) with exception type java.io.IOException

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions