basho/riak-java-client — pull request #227 by javajolt (2013-04-18 22:30:32+00:00)
Title: Issue #218: Handle Link Walking case with a Depth of One

For whatever reason, in the case where the depth of the link walk is only one, MapReduce returns an element instead of an JSON Array. See com.basho.riak.pbc.MapReduceResponseSource.readAllResults() at https://github.com/basho/riak-java-client/blob/master/src/main/java/com/basho/riak/pbc/MapReduceResponseSource.java#L137 .
Basically the nesting gets messed up and com.basho.riak.client.raw.pbc.PBClientAdapter.linkWalkSecondPhase() had assumed a particular level of nesting. I'm not proud of the object-type test, but it seemed to be less intrusive than rewriting the MapReduce interface, especially when this is a PB-only bug.

Also I uncovered a different null pointer exception generated when a node in the map does not have any links. See com.basho.riak.client.raw.pbc.mapToRiakObject().

Added two integration tests to cover these cases as well.