cwensel/cascading — pull request #8 by petergoldstein (2012-08-03 13:21:43+00:00)
Title: Updating Tap's outgoingScopeFor so that it gracefully handles null or empty HashSets

I ran into this issue when upgrading cascading.jruby from Cascading 2.0.0-wip-255 to 2.0.3. A number of tests in the cascading.jruby suite started failing, throwing a somewhat obscure exception on HashMap from the underlying Cascading library.

The issue turns out to have been introduced in this [commit](https://github.com/cwensel/cascading/commit/5ea3837fc0676bcc035acc0f76e93e987c00cc15#src/core/cascading/tap/Tap.java). The logic allowing the passthrough of incoming to outgoing now throws a somewhat obscure error if the incomingScopes HashSet is null or empty.

I believe that the behavior for this case should be unchanged from before this commit, and that the method should return new Scope( getSourceFields() ) and not throw an exception, but it's possible I'm misunderstanding the code. If the code should throw an exception, I recommend that the the null and/or empty argument cases should be handled by throwing dedicated FlowException(s).

Code compiles and all tests run green. I've also tried to match the style (braces, etc.) used in the rest of the source code.

Ideally I'd like to see this in 2.0.4, so I can update cascading.ruby to use a production release. Thoughts?