You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/03/14 20:50:34 UTC

[GitHub] [hudi] vinothchandar commented on a change in pull request #4167: [HUDI-2880] Fixing loading of props from default dir

vinothchandar commented on a change in pull request #4167:
URL: https://github.com/apache/hudi/pull/4167#discussion_r826365626



##########
File path: hudi-common/src/main/java/org/apache/hudi/common/config/DFSPropertiesConfiguration.java
##########
@@ -97,11 +99,7 @@ public static TypedProperties loadGlobalProps() {
     if (defaultConfPath.isPresent()) {
       conf.addPropsFromFile(defaultConfPath.get());
     } else {
-      try {
-        conf.addPropsFromFile(new Path(DEFAULT_CONF_FILE_DIR));
-      } catch (Exception ignored) {

Review comment:
       this is actually preferrable to leaking the check for a default path inside `addPropsFromFile` 

##########
File path: hudi-common/src/main/java/org/apache/hudi/common/config/DFSPropertiesConfiguration.java
##########
@@ -128,14 +126,19 @@ public void addPropsFromFile(Path filePath) {
         filePath.toString(),
         Option.ofNullable(hadoopConfig).orElseGet(Configuration::new)
     );
+    try {
+      if (filePath.equals(DEFAULT_PATH) && !fs.exists(filePath)) {
+        LOG.warn("Properties file " + filePath + " not found. Ignoring to load props file");
+        return;
+      }
 
-    try (BufferedReader reader = new BufferedReader(new InputStreamReader(fs.open(filePath)))) {
+      BufferedReader reader = new BufferedReader(new InputStreamReader(fs.open(filePath)));

Review comment:
       why remove the `try` here? it closes the reader correctly right ?




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org