Uploaded image for project: 'Spring Data Redis'
  1. Spring Data Redis
  2. DATAREDIS-852

NullPointerException using Lettuce with Range.Bound.unbounded()

    Details

      Description

      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:

      java.lang.NullPointerException: null at org.springframework.data.redis.connection.lettuce.LettuceReactiveZSetCommands.lambda$null$20(LettuceReactiveZSetCommands.java:196) ...
      

      The same bug likely occurs in a bunch of other places related with ranges (same code style, did not repro yet), namely:

      • org.springframework.data.redis.connection.lettuce.LettuceReactiveListCommands#lRange
      • * org.springframework.data.redis.connection.lettuce.LettuceReactiveListCommands#lTrim
      • * org.springframework.data.redis.connection.lettuce.LettuceReactiveStringCommands#getRange

      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.

        Attachments

          Activity

            People

            • Assignee:
              mp911de Mark Paluch
              Reporter:
              Mancioppi Michele
              Last updater:
              Mark Paluch
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: