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

Matt Foley commented on HADOOP-7328:
------------------------------------

Moving this discussion back to the Jira to decrease the number and size of 
emails and jira appends :-)

It appears to me that getSerializer() should throw an exception on failure to 
return a usable value, because:
* The method is only called on objects for which a serializer is expected to 
exist, so this truly is an "exceptional" condition.
* The typical caller has no alternate strategy, as far as I know, so it will 
have to do a check for null then throw an exception anyway.

The argument for consistency has merit, but this is all Hadoop stuff, so it is 
okay for us to improve the semantics, if such it would be.  Nevertheless, I'm a 
"0" on this, do what you think best.

And yes, please, any method that might return null should clearly document that 
fact in the javadocs.

> Give more information about a missing Serializer class
> ------------------------------------------------------
>
>                 Key: HADOOP-7328
>                 URL: https://issues.apache.org/jira/browse/HADOOP-7328
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: io
>    Affects Versions: 0.20.2
>            Reporter: Harsh J
>            Assignee: Harsh J
>              Labels: io, serialization
>             Fix For: 0.23.0
>
>         Attachments: HADOOP-7328.r1.diff, HADOOP-7328.r2.diff
>
>
> When you have a key/value class that's non Writable and you forget to attach 
> io.serializers for the same, an NPE is thrown by the tasks with no 
> information on why or what's missing and what led to it. I think a better 
> exception can be thrown by SerializationFactory instead of an NPE when a 
> class is not found accepted by any of the loaded ones.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to