You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ew...@apache.org on 2016/10/18 21:17:51 UTC

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

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.