Abacn commented on code in PR #38525:
URL: https://github.com/apache/beam/pull/38525#discussion_r3260538027
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/options/PipelineOptionsFactory.java:
##########
@@ -1801,11 +1801,22 @@ static Object deserializeNode(JsonNode node, Method
method) throws IOException {
return null;
}
- JsonParser parser = new TreeTraversingParser(node, MAPPER);
- parser.nextToken();
-
JsonDeserializer<Object> jsonDeserializer =
getDeserializerForMethod(method);
- return jsonDeserializer.deserialize(parser,
DESERIALIZATION_CONTEXT.copy());
+ if (jsonDeserializer == null) {
+ JavaType javaType = MAPPER.constructType(method.getGenericReturnType());
+ return MAPPER.treeToValue(node, javaType);
+ }
+
+ try {
+ JsonParser parser = new TreeTraversingParser(node, MAPPER);
+ parser.nextToken();
+ return jsonDeserializer.deserialize(parser,
DESERIALIZATION_CONTEXT.copy());
+ } catch (NullPointerException e) {
Review Comment:
catch an NPE is almost always an anti-pattern. Let me check what happens
caused NPE here, and stack trace?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]