Skip to content

Fix Resource Leaks Using Try-With-Resources #585

@PritamP20

Description

@PritamP20

Title

Fix Resource Leaks Using Try-With-Resources


Description

Some files in the JPF codebase don’t properly close streams like FileInputStream and BufferedReader, which can cause file handle exhaustion and memory leaks. These should use Java’s try-with-resources pattern instead of manual close calls.


Affected Files

  • JPF_java_lang_System.java
  • LogConsole.java
  • RepositoryEntry.java
  • Config.java
  • JPFSiteUtils.java

Example

Current

FileInputStream fis = new FileInputStream(cf);
p.load(fis);

Fix

try (FileInputStream fis = new FileInputStream(cf)) {
  p.load(fis);
}

Acceptance Criteria

  • All unclosed resources use try-with-resources
  • No manual .close() calls remain
  • All tests pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions