[ https://issues.apache.org/jira/browse/KAFKA-4855?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15940263#comment-15940263 ]
ASF GitHub Bot commented on KAFKA-4855: --------------------------------------- GitHub user baluchicken opened a pull request: https://github.com/apache/kafka/pull/2732 KAFKA-4855 Struct SchemaBuilder should not allow duplicate fields @ewencp can you please review. You can merge this pull request into a Git repository by running: $ git pull https://github.com/baluchicken/kafka-1 KAFKA-4855 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/2732.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2732 ---- commit 2fd680a1e76ac3c4c0337e397979321cac49aefa Author: Balint Molnar <balintmolna...@gmail.com> Date: 2017-03-24T12:49:07Z KAFKA-4855 Struct SchemaBuilder should not allow duplicate fields ---- > Struct SchemaBuilder should not allow duplicate fields. > ------------------------------------------------------- > > Key: KAFKA-4855 > URL: https://issues.apache.org/jira/browse/KAFKA-4855 > Project: Kafka > Issue Type: Bug > Components: KafkaConnect > Affects Versions: 0.10.2.0 > Reporter: Jeremy Custenborder > Assignee: Balint Molnar > Labels: newbie > > I would expect this to fail at the build() on schema. It actually makes it > all the way to Struct.validate() and throws a cryptic error message. .field() > should throw an exception if a field is already used. > Repro: > {code} > @Test > public void duplicateFields() { > final Schema schema = SchemaBuilder.struct() > .name("testing") > .field("id", SchemaBuilder.string().doc("").build()) > .field("id", SchemaBuilder.string().doc("").build()) > .build(); > final Struct struct = new Struct(schema) > .put("id", "testing"); > struct.validate(); > } > {code} > {code} > org.apache.kafka.connect.errors.DataException: Invalid value: null used for > required field at > org.apache.kafka.connect.data.ConnectSchema.validateValue(ConnectSchema.java:212) > at org.apache.kafka.connect.data.Struct.validate(Struct.java:232) > at > io.confluent.kafka.connect.jms.RecordConverterTest.duplicateFieldRepro(RecordConverterTest.java:289) > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346)