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

jfim pushed a commit to branch minor-deserialization-fixes
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit 2d49eb20b7a9021672fc578b5df404253ea4e1e0
Author: Jean-Francois Im <[email protected]>
AuthorDate: Thu Nov 15 12:49:16 2018 -0800

    Minor deserialization fixes
    
    - Add a missing conversion from ArrayList to Set
    - Avoid an NPE from being thrown during value injection. The injection
      behavior stays the same, this just removes the NPE.
---
 .../java/com/linkedin/pinot/common/config/Deserializer.java    | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git 
a/pinot-common/src/main/java/com/linkedin/pinot/common/config/Deserializer.java 
b/pinot-common/src/main/java/com/linkedin/pinot/common/config/Deserializer.java
index 05ccba5..c667366 100644
--- 
a/pinot-common/src/main/java/com/linkedin/pinot/common/config/Deserializer.java
+++ 
b/pinot-common/src/main/java/com/linkedin/pinot/common/config/Deserializer.java
@@ -159,6 +159,11 @@ public class Deserializer {
       return list;
     });
 
+    typeConverters.put(Tuple.of(ArrayList.class, Set.class), items -> {
+      ArrayList list = (ArrayList) items;
+      return new HashSet(list);
+    });
+
     // Mark all types that have a converter as simple types
     simpleTypes = new HashSet<>();
     typeConverters
@@ -232,7 +237,10 @@ public class Deserializer {
 
               LOGGER.debug("Extracting value from field {} of {}, values are 
{}", dslInfo.value(), dslValue, dslValues);
 
-              valueInjected |= coerceValueIntoField(rootObject, declaredField, 
dslValues.getOrElse(dslInfo.value(), null));
+              if (dslValues != null) {
+                valueInjected |=
+                    coerceValueIntoField(rootObject, declaredField, 
dslValues.getOrElse(dslInfo.value(), null));
+              }
             }
           } else if (useChildKeyHandler != null) {
             // Use a child key handler to handle this value


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to