[DATAREDIS-852] NullPointerException using Lettuce with Range.Bound.unbounded() Created: 19/Jul/18 Updated: 26/Jul/18 Resolved: 24/Jul/18
|Project:||Spring Data Redis|
|Affects Version/s:||2.0.8 (Kay SR8)|
|Fix Version/s:||2.1 RC1 (Lovelace), 2.0.9 (Kay SR9)|
|Remaining Estimate:||Not Specified|
|Time Spent:||Not Specified|
|Original Estimate:||Not Specified|
|Pull Request URL:||https://github.com/spring-projects/spring-data-redis/pull/353|
The implementation of LettuceReactiveZSetCommands#zRange and LettuceReactiveZSetCommands.ArgumentConverters#rangeToBoundArgumentConverter break when the Range provided has a bound unbounded().
In the case of LettuceReactiveZSetCommands#zRange (and others), it is an unboxing issue. Since the code is using, e.g., command.getRange().getLowerBound().getValue().orElse(null) and the result is passed into RedisSortedSetReactiveCommands.zrange, which wants primitive longs, NPEs are thrown due to the unboxing:
The same bug likely occurs in a bunch of other places related with ranges (same code style, did not repro yet), namely:
In the case of LettuceReactiveZSetCommands.ArgumentConverters#rangeToBoundArgumentConverter, the issue is that the code simply cannot cope with an unbounded range, and instead of returning Boundary.unbounded(), throws another NPE.
|Comment by Michele [ 19/Jul/18 ]|
I have a commit to fix this, I want to polish it a tad and then I will open a PR in the next few days.
|Comment by Mark Paluch [ 19/Jul/18 ]|
Good catch. Happy to review your pull request.