You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2019/11/13 21:25:53 UTC

[GitHub] [accumulo] milleruntime commented on a change in pull request #1424: Fix check for Standalone properties file. Fixes #1168

milleruntime commented on a change in pull request #1424:  Fix check for Standalone properties file. Fixes #1168 
URL: https://github.com/apache/accumulo/pull/1424#discussion_r346009983
 
 

 ##########
 File path: test/src/main/java/org/apache/accumulo/harness/conf/AccumuloClusterPropertyConfiguration.java
 ##########
 @@ -57,33 +57,13 @@ public static AccumuloClusterPropertyConfiguration get() {
     if (propertyFile != null) {
       // Check for properties provided in a file
       File f = new File(propertyFile);
-      if (f.exists() && f.isFile() && f.canRead()) {
-        Properties fileProperties = new Properties();
-        FileReader reader = null;
-        try {
-          reader = new FileReader(f);
-        } catch (FileNotFoundException e) {
-          log.warn("Could not read properties from specified file: {}", propertyFile, e);
-        }
-
-        if (reader != null) {
-          try {
-            fileProperties.load(reader);
-          } catch (IOException e) {
-            log.warn("Could not load properties from specified file: {}", propertyFile, e);
-          } finally {
-            try {
-              reader.close();
-            } catch (IOException e) {
-              log.warn("Could not close reader", e);
-            }
-          }
-
-          clusterTypeValue = fileProperties.getProperty(ACCUMULO_CLUSTER_TYPE_KEY);
-          clientConf = fileProperties.getProperty(ACCUMULO_CLUSTER_CLIENT_CONF_KEY);
-        }
-      } else {
-        log.debug("Property file ({}) is not a readable file", propertyFile);
+      Properties fileProperties = new Properties();
+      try (FileReader reader = new FileReader(f)) {
+        fileProperties.load(reader);
+        clusterTypeValue = fileProperties.getProperty(ACCUMULO_CLUSTER_TYPE_KEY);
+        clientConf = fileProperties.getProperty(ACCUMULO_CLUSTER_CLIENT_CONF_KEY);
+      } catch (IOException e) {
+        throw new RuntimeException("Could not read properties from file: " + propertyFile, e);
 
 Review comment:
   Oh yeah... I always forget about that guy.

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


With regards,
Apache Git Services