You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by xu...@apache.org on 2022/04/21 17:48:38 UTC

[hudi] 07/16: Fixing NPEs

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

xushiyan pushed a commit to branch rc3-patched-for-test
in repository https://gitbox.apache.org/repos/asf/hudi.git

commit 398def9637b214886411e83ffc8bcea57a785c93
Author: Alexey Kudinkin <al...@infinilake.com>
AuthorDate: Wed Apr 20 15:29:18 2022 -0700

    Fixing NPEs
---
 .../src/main/java/org/apache/hudi/common/util/ReflectionUtils.java    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hudi-common/src/main/java/org/apache/hudi/common/util/ReflectionUtils.java b/hudi-common/src/main/java/org/apache/hudi/common/util/ReflectionUtils.java
index 13228c440c..8ac4b0fa58 100644
--- a/hudi-common/src/main/java/org/apache/hudi/common/util/ReflectionUtils.java
+++ b/hudi-common/src/main/java/org/apache/hudi/common/util/ReflectionUtils.java
@@ -124,7 +124,9 @@ public class ReflectionUtils {
    * @return new instance of the class
    */
   public static <T> T newInstanceUnchecked(Class<T> klass, Object... ctorArgs) {
-    Class<?>[] ctorArgTypes = Arrays.stream(ctorArgs).map(Object::getClass).toArray(Class<?>[]::new);
+    Class<?>[] ctorArgTypes = Arrays.stream(ctorArgs)
+        .map(arg -> Objects.requireNonNull(arg).getClass())
+        .toArray(Class<?>[]::new);
     return newInstanceUnchecked(klass, ctorArgTypes, ctorArgs);
   }