shaikzakiriitm edited a comment on pull request #9306: URL: https://github.com/apache/kafka/pull/9306#issuecomment-702221113
Following are the version dependencies of Apache Kafka (ak) on com.fasterxml.jackson.core:jackson-databind (j) - ak v2.1.0 -> j v2.9.7 - ak v2.1.1 -> j v2.9.8 - ak v2.2.0 -> j v2.9.8 - ak v2.2.1 -> j v2.9.8 - ak v2.2.2 -> j v2.10.0 - ak v2.3.0 -> j v2.9.9 [**Looks like an outlier, where ak version increased with a decrease in jackson-databind version**] - ak v2.3.1 -> j v2.10.0 - ak v2.4.0 -> j v2.10.0 - ak v2.4.1 -> j v2.10.0 - ak v2.5.1 -> j v2.10.2 - ak v2.6 -> j v2.10.2 The behavior of the Jackson ObjectMapper#readTree() method when called with a blank string/empty-input changed as follows (based on the information from FasterXML/jackson-databind#2211) : - For Jackson v2.x-2.8.x, return NullNode - For Jackson v2.9.x return null - For Jackson v2.10.0 and beyond return MissingNode However, in all AK versions JsonConverter throws an error when it gets a MissingNode. This is only a problem for AK versions (v2.2.2, v2.3.1, v2.4.0, v2.4.1, v2.5.1, v2.6) that were released with Jackson 2.10.0 or later: - All versions of AK 2.1.x-2.2.1, ObjectMapper.readTree() returns null on empty input, which AK populates in an envelope, and the payload in the envelope which is null is treated as json node of JsonNodeType NULL. And this NULL case is handled in `JsonConverter#convertToConnect()`. - AK version 2.2.2, ObjectMapper.readTree() returns MissingNode on empty input, which AK populates as payload in envelope; this payload is a jsonNode of JsonNodeType MISSING. And `JsonConverter#convertToConnect()` considers `schemaType` to be null for MISSING case, which results in `DataException`. - AK 2.3.0, (uses jackson-databind version 2.9.9), ObjectMapper.readTree() returns null on empty input, which AK populates as payload in envelope; this payload when retrieved in to be used in JsonConverter.convertToConnect(), is treated as NullNode, of JsonNodeType NULL. (as in the case of AK 2.1.x-2.2.1). - AK 2.3.1-2.6, ObjectMapper.readTree() returns MissingNode on empty input, which AK populates as payload in envelope; this payload is a jsonNode of type MISSING which causes the DataException. So, this PR aims to resolve the DataException that gets thrown when jackson-databind's `ObjectMapper.readTree()` returns MissingNode upon encountering an empty input, so that JsonConverter treats MissingNode in a similar behavior as that of null. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org