You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ne...@apache.org on 2022/06/02 08:45:38 UTC

[iotdb] branch master updated: [ISSUE-5878] Fix FileOutputStream not close automatically

This is an automated email from the ASF dual-hosted git repository.

neuyilan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 3c3d6bd4c3 [ISSUE-5878] Fix FileOutputStream not close automatically
3c3d6bd4c3 is described below

commit 3c3d6bd4c378a2fa2fe5e7d96f9691fca5f8a7d0
Author: wallezhang <do...@gmail.com>
AuthorDate: Thu Jun 2 16:45:32 2022 +0800

    [ISSUE-5878] Fix FileOutputStream not close automatically
---
 .../java/org/apache/iotdb/confignode/conf/ConfigNodeStartupCheck.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeStartupCheck.java b/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeStartupCheck.java
index 999ea0163c..f292d7c457 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeStartupCheck.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeStartupCheck.java
@@ -243,8 +243,8 @@ public class ConfigNodeStartupCheck {
     systemProperties.setProperty(
         "confignode_list", NodeUrlUtils.convertTConfigNodeUrls(conf.getConfigNodeList()));
 
-    try {
-      systemProperties.store(new FileOutputStream(systemPropertiesFile), "");
+    try (FileOutputStream fileOutputStream = new FileOutputStream(systemPropertiesFile)) {
+      systemProperties.store(fileOutputStream, "");
     } catch (IOException e) {
       LOGGER.error(
           "Can't store system properties file {}.", systemPropertiesFile.getAbsolutePath());