kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ij...@apache.org
Subject kafka git commit: MINOR: Clarify how to fix conversion issues when plain JSON data is used with schemas.enable=true
Date Tue, 15 Nov 2016 14:23:45 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk a32962af1 -> 31203efcb


MINOR: Clarify how to fix conversion issues when plain JSON data is used with schemas.enable=true

Author: Ewen Cheslack-Postava <me@ewencp.org>

Reviewers: Ismael Juma <ismael@juma.me.uk>

Closes #2041 from ewencp/clarify-json-converter-failure


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/31203efc
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/31203efc
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/31203efc

Branch: refs/heads/trunk
Commit: 31203efcb20b7efcbad5984b377ad87c58673dbc
Parents: a32962a
Author: Ewen Cheslack-Postava <me@ewencp.org>
Authored: Tue Nov 15 14:23:36 2016 +0000
Committer: Ismael Juma <ismael@juma.me.uk>
Committed: Tue Nov 15 14:23:36 2016 +0000

----------------------------------------------------------------------
 .../main/java/org/apache/kafka/connect/json/JsonConverter.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/31203efc/connect/json/src/main/java/org/apache/kafka/connect/json/JsonConverter.java
----------------------------------------------------------------------
diff --git a/connect/json/src/main/java/org/apache/kafka/connect/json/JsonConverter.java b/connect/json/src/main/java/org/apache/kafka/connect/json/JsonConverter.java
index a4ce32a..dd83886 100644
--- a/connect/json/src/main/java/org/apache/kafka/connect/json/JsonConverter.java
+++ b/connect/json/src/main/java/org/apache/kafka/connect/json/JsonConverter.java
@@ -306,7 +306,8 @@ public class JsonConverter implements Converter {
         }
 
         if (enableSchemas && (jsonValue == null || !jsonValue.isObject() || jsonValue.size()
!= 2 || !jsonValue.has("schema") || !jsonValue.has("payload")))
-            throw new DataException("JsonDeserializer with schemas.enable requires \"schema\"
and \"payload\" fields and may not contain additional fields");
+            throw new DataException("JsonConverter with schemas.enable requires \"schema\"
and \"payload\" fields and may not contain additional fields." +
+                    " If you are trying to deserialize plain JSON data, set schemas.enable=false
in your converter configuration.");
 
         // The deserialized data should either be an envelope object containing the schema
and the payload or the schema
         // was stripped during serialization and we need to fill in an all-encompassing schema.


Mime
View raw message