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 2021/08/19 17:20:49 UTC

[GitHub] [hudi] vinothchandar commented on a change in pull request #3505: [HUDI-2321] Fix ClassLoader error due to HoodieConfig$setDefaults() m…

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



##########
File path: hudi-common/src/main/java/org/apache/hudi/common/config/HoodieConfig.java
##########
@@ -93,26 +95,12 @@ public HoodieConfig(Properties props) {
         return Option.ofNullable(props.get(alternative));
       }
     }
+    if (setDefaultValue && configProperty.hasDefaultValue()) {
+      return Option.ofNullable(configProperty.defaultValue());
+    }
     return Option.empty();
   }
 
-  protected void setDefaults(String configClassName) {
-    Class<?> configClass = ReflectionUtils.getClass(configClassName);
-    Arrays.stream(configClass.getDeclaredFields())
-        .filter(f -> Modifier.isStatic(f.getModifiers()))
-        .filter(f -> f.getType().isAssignableFrom(ConfigProperty.class))
-        .forEach(f -> {
-          try {
-            ConfigProperty<?> cfgProp = (ConfigProperty<?>) f.get("null");
-            if (cfgProp.hasDefaultValue()) {
-              setDefaultValue(cfgProp);
-            }
-          } catch (IllegalAccessException e) {
-            e.printStackTrace();

Review comment:
       this is worth fixing and throwing a runtime error back




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