[
https://issues.apache.org/jira/browse/CRUNCH-446?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Allan Shoup updated CRUNCH-446:
-------------------------------
Attachment: CRUNCH-446.2.patch
Thinking through this a bit more, it might be helpful to make the guarantee
that all the getter methods will never return null (including getContext and
getConfiguration). This would prevent confusion among consumers thinking they
might have to check for null when calling them. I added patch 2 that implements
this idea. I changed the NPEs to IllegalStateException to make it clear that
something should have happened prior to calling the getters. Let me know if you
think this is an improvement.
> Add null checks for DoFn fields
> -------------------------------
>
> Key: CRUNCH-446
> URL: https://issues.apache.org/jira/browse/CRUNCH-446
> Project: Crunch
> Issue Type: Improvement
> Reporter: Allan Shoup
> Priority: Minor
> Attachments: CRUNCH-446.2.patch, 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
(v6.2#6252)