kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ewe...@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, 18 Oct 2016 21:17:51 GMT
Repository: kafka
Updated Branches:
  refs/heads/clarify-json-converter-failure [created] e233a3216


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


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

Branch: refs/heads/clarify-json-converter-failure
Commit: e233a32169006695d6129de859671a307203b044
Parents: 6f842c1
Author: Ewen Cheslack-Postava <me@ewencp.org>
Authored: Tue Oct 18 14:17:44 2016 -0700
Committer: Ewen Cheslack-Postava <me@ewencp.org>
Committed: Tue Oct 18 14:17:44 2016 -0700

----------------------------------------------------------------------
 .../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/e233a321/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