+
Skip to content

Resources leak. SAST #40660

Open
Open
@LM4O322

Description

@LM4O322

Description

Okay, let`s go

It seems that unclosed threads can lead to resource leaks and additional load on the system.
Below are a few places where the streams are potentially not closed.

Discussion

Motivation

No response

Details

The stream opens here:

InputStream stream = FindFile.findFile(keystoreFile);

and it doesn't close if an exception is thrown:

throw new RuntimeException("Failed to load private key: " + e.getMessage(), e);

I assume that closing the stream is not necessary in this situation, however, in order to avoid resource leakage, it seems to me that it is worth using the try-with-resources construction.


InputStream result = doPost(server + "/realms/" + realm + "/protocol/openid-connect/token",

is not closed, including function call situations


Identical creation of a stream without its further closure is prescribed

InputStream result = doPost(server + "/realms/" + realm + "/protocol/openid-connect/token",


InputStream result = doPost(server + "/realms/" + realm + "/protocol/openid-connect/token",

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载