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

Problems when deserializing an empty list with RedisHash

    Details

      Description

      When deserializing an empty list from a RedisHash object with a nested object having an identically named list, the outer list will be populated with an equivalent amount of nulls of the inner list.

      Example RedisHash classes:

      public class Inner {
          private List<String> ibans;
      
          // Getters/Setters/Constructor
      }
      
      @RedisHash
      public class Outer {
          private List<String> ibans;
          private List<Inner> inners;
      
          // Getters/Setters/Constructor
      }
      

      When saving such an Outer object with ibans being an empty list, in Redis there will be no hash entry for that (which is fine). The deserialized list isn't empty but contains as many nulls as on of the inner iban lists.

      The problem seems to be the regular expression in Bucket.java in the method extractAllKeysFor. I think the regex should be

      "^(" + Pattern.quote(path) + ")\\.\\[.*?\\]"
      

      instead (with ^).

       

      Let me know if you need further input!

       

        Attachments

          Activity

            People

            • Assignee:
              cstrobl Christoph Strobl
              Reporter:
              chrisigel ChrisIgel
              Last updater:
              Mark Paluch
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: