Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-16217

(7.2.z) ISPN-9705/ HHH-12457 - SpringCache Put null value and get(key, clazz) IllegalStateException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • None
    • None

      SpringCacheTest.java
      public void testPutNullError() {
            //when//then
            cache.put("key", null);
       
            cache.get("key", String.class);
         }
      

      We get

      java.lang.IllegalStateException: Cached value is not of required type [java.lang.String]: org.infinispan.spring.provider.NullValue@76f7d241
      

      JavaDoc for this method states this method does not make difference between cached null and null value.

      Note: This variant of

      {@code get}

      does not allow for differentiating

      between a cached

      {@code null}

      value and no cache entry found at all.

      Use the standard

      {@link #get(Object)}

      variant for that purpose instead.

              spyrkob Bartosz Spyrko-Smietanko
              spyrkob Bartosz Spyrko-Smietanko
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: