crunch-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allan Shoup (JIRA)" <>
Subject [jira] [Commented] (CRUNCH-446) Add null checks for DoFn fields
Date Thu, 17 Jul 2014 13:48:04 GMT


Allan Shoup commented on CRUNCH-446:

Yeah, I was torn on how to implement those. I considered checking for null and then throwing
a NullPointerException explicitly as well as just leaving the original code alone and letting
it continue to throw an NPE. In the end, considering that methods like getContext and getConfiguration
return null, I decided to make all getter methods return null to be consistent. I wouldn't
be opposed if you wanted to change that, however.

> Add null checks for DoFn fields
> -------------------------------
>                 Key: CRUNCH-446
>                 URL:
>             Project: Crunch
>          Issue Type: Improvement
>            Reporter: Allan Shoup
>            Priority: Minor
>         Attachments: CRUNCH-446.patch
> DoFn.getConfiguration() gracefully handles the fields being null, but most other methods
do not. Adding null checks around all field access within DoFn would make it easier for consumers
to write tests for their own function classes because they would not be required to set the
context, for instance.

This message was sent by Atlassian JIRA

View raw message