[ 
https://issues.apache.org/jira/browse/KAFKA-5550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16078943#comment-16078943
 ] 

ASF GitHub Bot commented on KAFKA-5550:
---------------------------------------

GitHub user jcustenborder opened a pull request:

    https://github.com/apache/kafka/pull/3507

    KAFKA-5550 

    Changed call to use the overload of ConnectSchema.validate method with the 
field name passed in. Ensure that field in put call is not null.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jcustenborder/kafka KAFKA-5550

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/3507.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 #3507
    
----
commit 91741942912426e33ad032cdddfeecbc66edd37c
Author: Jeremy Custenborder <jcustenbor...@gmail.com>
Date:   2017-07-01T02:07:10Z

    KAFKA-5550 Changed call to use the overload of 
ConnectSchema.validateValue() method with the field name passed in. Ensure that 
field in put call is not null.

----


> Struct.put() should include the field name if validation fails
> --------------------------------------------------------------
>
>                 Key: KAFKA-5550
>                 URL: https://issues.apache.org/jira/browse/KAFKA-5550
>             Project: Kafka
>          Issue Type: Bug
>          Components: KafkaConnect
>            Reporter: Jeremy Custenborder
>            Assignee: Jeremy Custenborder
>            Priority: Minor
>
> When calling struct.put() with an invalid value, the error message should 
> include the field name.
> {code:java}
> @Test
> public void testPutIncludesFieldName() {
>     final String fieldName = "fieldName";
>     Schema testSchema = SchemaBuilder.struct()
>         .field(fieldName, Schema.STRING_SCHEMA);
>     Struct struct = new Struct(testSchema);
>     try {
>         struct.put(fieldName, null);
>     } catch (DataException ex) {
>         assertEquals(
>             "Invalid value: null used for required field: \"fieldName\", 
> schema type: STRING",
>             ex.getMessage()
>         );
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to