Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use try with resource to close FileReader in DB.java #254

Closed
chhil opened this issue Jul 5, 2022 · 0 comments · Fixed by #255
Closed

Use try with resource to close FileReader in DB.java #254

chhil opened this issue Jul 5, 2022 · 0 comments · Fixed by #255

Comments

@chhil
Copy link
Contributor

chhil commented Jul 5, 2022

As I migrate to the current jpos/jposee, I run sonarqube scanner and it picked this up.

if (f.exists())
{
props.load(new FileReader(f));
}

If it makes sense, change it to the following so that the file is always closed, or add a finally block to close it.

        if (f.exists()) {
            try (FileReader fr = new FileReader(f)) {
                props.load(fr);
            }
        }
ar added a commit that referenced this issue Jul 7, 2022
@ar ar closed this as completed in #255 Jul 7, 2022
ar added a commit that referenced this issue Jul 7, 2022
…ereader

Use try with resource to close FileReader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant