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

(7.0.z) ISPN-6045 - TransactionAwareKeyCloseableIterator.remove uses previousValue which is never set

    Details

    • Type: Bug
    • Status: Verified (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 7.0.3.GA
    • Fix Version/s: 7.0.4.CR1, 7.0.4.GA
    • Component/s: None
    • Labels:
      None

      Description

      TransactionAwareKeyCloseableIterator.remove is implemented as

      cache.remove(previousValue);
      

      But looking at the previousValue it never gets set. This results then in

      java.lang.NullPointerException: Null keys are not supported!
      	at org.infinispan.cache.impl.CacheImpl.assertKeyNotNull(CacheImpl.java:224)
      	at org.infinispan.cache.impl.CacheImpl.remove(CacheImpl.java:547)
      	at org.infinispan.cache.impl.CacheImpl.remove(CacheImpl.java:543)
      	at org.infinispan.interceptors.TxInterceptor$TransactionAwareKeyCloseableIterator.remove(TxInterceptor.java:568)
      

      I encountered this when trying to switch infinispan from 7.2 to 8.1 in conjunction with hibernate-infinispan 4.3 which does the following code to clear the cache:

      	public static void removeAll(AdvancedCache cache) {
      		try {
      			Iterator it = cache.keySet().iterator();
      			while (it.hasNext()) {
      				it.next(); // Necessary to get next element
      				it.remove();
      				}
      		} catch (UnsupportedOperationException e) {
      			// Fallback on using clear for older version
      			cache.clear();
      		}
      	}
      

      from https://github.com/hibernate/hibernate-orm/blob/4.3/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/Caches.java

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  william.burns Will Burns
                  Reporter:
                  bmaxwell Brad Maxwell
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: