-
Notifications
You must be signed in to change notification settings - Fork 5k
[BUG] Fix bug: Use try-with-resources or close this "Socket" in a "finally" clause. #1714
Description
Describe the bug
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 it's on to their knees.
File
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/utils/FourLetterWordMain.java
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&issues=AW9PvkJkYzPBRjkobY5H&open=AW9PvkJkYzPBRjkobY5H
https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&issues=AW9PvkJkYzPBRjkobY5F&open=AW9PvkJkYzPBRjkobY5F
https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&issues=AW9PvkJkYzPBRjkobY5G&open=AW9PvkJkYzPBRjkobY5G