kafka-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremy Custenborder (JIRA)" <j...@apache.org>
Subject [jira] [Created] (KAFKA-5550) Struct.put() should include the field name if validation fails
Date Sat, 01 Jul 2017 01:56:03 GMT
Jeremy Custenborder created KAFKA-5550:
------------------------------------------

             Summary: 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)

Mime
View raw message