[
https://issues.apache.org/jira/browse/SAMZA-643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14542942#comment-14542942
]
Gustavo Anatoly commented on SAMZA-643:
---------------------------------------
Thanks for review [~closeuris].
{quote}
1) it's not worth introducing a new dependency for the simple string check
{quote}
In this case I agree, it's not worth just to checking a simple condition.
{quote}
2) prefer the check happens in the application-level, not the API level, which
is too strict. One suggestion is that, the check and exception can happen in
the send() method of KafkaSystemProducer.
{quote}
The main reason to throw the exception on SystemStream was to put the action
more close of who have the "responsability". Once we have the stream name
belongs
to SystemStream.
I going follow your observations and move the code to
KafkaSystemProducer#send() and readjust the test case.
Thanks again.
Cheers.
> Improve error message for null stream in OutgoingMessageEnvelope
> ----------------------------------------------------------------
>
> Key: SAMZA-643
> URL: https://issues.apache.org/jira/browse/SAMZA-643
> Project: Samza
> Issue Type: Improvement
> Components: kafka
> Affects Versions: 0.9.0
> Reporter: Roger Hoover
> Priority: Minor
> Labels: newbie
> Fix For: 0.10.0
>
>
> If you accidentally pass null as the stream name in an
> OutgoingMessageEnvelope, you get an NPE in the producer IO thread for Kafka.
> The Kafka producer shouldn't really throw NPE for this
> (https://issues.apache.org/jira/browse/KAFKA-2105) but Samza should probably
> throw a more friendly error sooner.
> Uncaught error in kafka producer I/O thread:
> java.lang.NullPointerException
> at org.apache.kafka.common.utils.Utils.utf8Length(Utils.java:174)
> at org.apache.kafka.common.protocol.types.Type$5.sizeOf(Type.java:176)
> at
> org.apache.kafka.common.protocol.types.ArrayOf.sizeOf(ArrayOf.java:55)
> at org.apache.kafka.common.protocol.types.Schema.sizeOf(Schema.java:81)
> at org.apache.kafka.common.protocol.types.Struct.sizeOf(Struct.java:218)
> at
> org.apache.kafka.common.requests.RequestSend.serialize(RequestSend.java:35)
> at
> org.apache.kafka.common.requests.RequestSend.<init>(RequestSend.java:29)
> at
> org.apache.kafka.clients.NetworkClient.metadataRequest(NetworkClient.java:369)
> at
> org.apache.kafka.clients.NetworkClient.maybeUpdateMetadata(NetworkClient.java:391)
> at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:188)
> at
> org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:191)
> at
> org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:122)
> at java.lang.Thread.run(Thread.java:745)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)