You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/07/13 14:51:10 UTC

[incubator-iotdb] branch rel/0.10 updated: [IOTDB-794][To rel/0.10] fix upgrade system.properties (#1492)

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

qiaojialin pushed a commit to branch rel/0.10
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/rel/0.10 by this push:
     new c587352  [IOTDB-794][To rel/0.10] fix upgrade system.properties (#1492)
c587352 is described below

commit c5873524eccfb0718bab52c615eb58a90b9d5ca0
Author: Haonan <hh...@outlook.com>
AuthorDate: Mon Jul 13 22:50:53 2020 +0800

    [IOTDB-794][To rel/0.10] fix upgrade system.properties (#1492)
    
    * fix tmpProperties
---
 .../java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java    | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
index c40fb43..d7c3a63 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfigCheck.java
@@ -177,8 +177,10 @@ public class IoTDBConfigCheck {
     }
 
     // no tmp file, read properties from system.properties
-    try (FileInputStream inputStream = new FileInputStream(propertiesFile)) {
-      properties.load(new InputStreamReader(inputStream, TSFileConfig.STRING_CHARSET));
+    try (FileInputStream inputStream = new FileInputStream(propertiesFile);
+        InputStreamReader inputStreamReader = new InputStreamReader(
+            inputStream, TSFileConfig.STRING_CHARSET)) {
+      properties.load(inputStreamReader);
     }
     // need to upgrade from 0.9 to 0.10
     if (!properties.containsKey(IOTDB_VERSION_STRING)) {
@@ -215,9 +217,9 @@ public class IoTDBConfigCheck {
       if (propertiesFile.exists()) {
         Files.delete(propertiesFile.toPath());
       }
-      // rename system.properties.tmp to system.properties
-      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
     }
+    // rename system.properties.tmp to system.properties
+    FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
   }
 
 
@@ -246,9 +248,9 @@ public class IoTDBConfigCheck {
       if (propertiesFile.exists()) {
         Files.delete(propertiesFile.toPath());
       }
-      // rename system.properties.tmp to system.properties
-      FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
     }
+    // rename system.properties.tmp to system.properties
+    FileUtils.moveFile(tmpPropertiesFile, propertiesFile);
   }
 
   /**