Beyyes commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251000916
 
 

 ##########
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/postback/conf/PostBackSenderDescriptor.java
 ##########
 @@ -87,46 +87,42 @@ private void loadProps() {
     try {
       properties.load(inputStream);
 
-      conf.serverIp = properties.getProperty("server_ip", conf.serverIp);
-      conf.serverPort = Integer
-          .parseInt(properties.getProperty("server_port", conf.serverPort + 
""));
+      conf.setServerIp(properties.getProperty("server_ip", 
conf.getServerIp()));
+      conf.setServerPort(Integer
+          .parseInt(properties.getProperty("server_port", conf.getServerPort() 
+ "")));
 
-      conf.clientPort = Integer
-          .parseInt(properties.getProperty("client_port", conf.clientPort + 
""));
-      conf.uploadCycleInSeconds = Integer
-          .parseInt(
-              properties.getProperty("upload_cycle_in_seconds", 
conf.uploadCycleInSeconds + ""));
-      conf.schemaPath = properties.getProperty("iotdb_schema_directory", 
conf.schemaPath);
-      conf.isClearEnable = Boolean
-          .parseBoolean(properties.getProperty("is_clear_enable", 
conf.isClearEnable + ""));
-      conf.uuidPath = conf.dataDirectory + "postback" + File.separator + 
"uuid.txt";
-      conf.lastFileInfo =
-          conf.dataDirectory + "postback" + File.separator + 
"lastLocalFileList.txt";
-
-      String[] snapshots = new String[conf.iotdbBufferwriteDirectory.length];
-      for (int i = 0; i < conf.iotdbBufferwriteDirectory.length; i++) {
-        conf.iotdbBufferwriteDirectory[i] = new 
File(conf.iotdbBufferwriteDirectory[i])
-            .getAbsolutePath();
-        if (!conf.iotdbBufferwriteDirectory[i].endsWith(File.separator)) {
-          conf.iotdbBufferwriteDirectory[i] = 
conf.iotdbBufferwriteDirectory[i] + File.separator;
+      conf.setClientPort(Integer
+          .parseInt(properties.getProperty("client_port", conf.getClientPort() 
+ "")));
+      conf.setUploadCycleInSeconds(Integer.parseInt(properties
+          .getProperty("upload_cycle_in_seconds", 
conf.getUploadCycleInSeconds() + "")));
+      conf.setSchemaPath(properties.getProperty("iotdb_schema_directory", 
conf.getSchemaPath()));
+      conf.setClearEnable(Boolean
+          .parseBoolean(properties.getProperty("is_clear_enable", 
conf.getClearEnable() + "")));
+      conf.setUuidPath(conf.getDataDirectory() + POSTBACK + File.separator + 
"uuid.txt");
+      conf.setLastFileInfo(
+          conf.getDataDirectory() + POSTBACK + File.separator + 
"lastLocalFileList.txt");
+      String[] iotdbBufferwriteDirectory = conf.getIotdbBufferwriteDirectory();
+      String[] snapshots = new 
String[conf.getIotdbBufferwriteDirectory().length];
+      for (int i = 0; i < conf.getIotdbBufferwriteDirectory().length; i++) {
+        iotdbBufferwriteDirectory[i] = new 
File(iotdbBufferwriteDirectory[i]).getAbsolutePath();
+        if (!iotdbBufferwriteDirectory[i].endsWith(File.separator)) {
+          iotdbBufferwriteDirectory[i] = iotdbBufferwriteDirectory[i] + 
File.separator;
         }
-        snapshots[i] =
-            conf.iotdbBufferwriteDirectory[i] + "postback" + File.separator + 
"dataSnapshot"
-                + File.separator;
+        snapshots[i] = iotdbBufferwriteDirectory[i] + POSTBACK + 
File.separator + "dataSnapshot"
+            + File.separator;
       }
-      conf.snapshotPaths = snapshots;
+      conf.setIotdbBufferwriteDirectory(iotdbBufferwriteDirectory);
+      conf.setSnapshotPaths(snapshots);
     } catch (IOException e) {
       LOGGER.warn("Cannot load config file because {}, use default 
configuration", e.getMessage());
     } catch (Exception e) {
       LOGGER.warn("Error format in config file because {}, use default 
configuration",
           e.getMessage());
     } finally {
-      if (inputStream != null) {
-        try {
-          inputStream.close();
-        } catch (IOException e) {
-          LOGGER.error("Fail to close config file input stream because {}", 
e.getMessage());
-        }
+      try {
+        inputStream.close();
+      } catch (IOException e) {
+        LOGGER.error("Fail to close config file input stream because {}", 
e.getMessage());
 
 Review comment:
   e.getMessage or e ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to