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-resources or close this "FileOutputStream" in a "finally" clause. #5881

Closed
MinaQin opened this issue May 12, 2022 · 0 comments · Fixed by #6135
Closed

Use try-with-resources or close this "FileOutputStream" in a "finally" clause. #5881

MinaQin opened this issue May 12, 2022 · 0 comments · Fixed by #6135

Comments

@MinaQin
Copy link
Contributor

MinaQin commented May 12, 2022

Code Path:confignode/src/main/java/org/apache/iotdb/confignode/persistence/NodeInfo.java
image
Connections, streams, files, and other classes that implement the Closeable interface or its super-interface, AutoCloseable, needs to be closed after use. Further, that close call must be made in a finally block otherwise an exception could keep the call from being made. Preferably, when class implements AutoCloseable, resource should be created using "try-with-resources" pattern and will be closed automatically.

Failure to properly close resources will result in a resource leak which could bring first the application and then perhaps the box the application is on to their knees.

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