Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-16284

PersistenceManagerImpl.acquireKeyFromContext(...) throws NPE when entry not found in InvocationContext

XMLWordPrintable

      As of Infinispan 14.0.29.Final, PersistenceManagerImpl.acquireKeyFromContext(...) looks like:

         private <K, V, WCT extends WriteCommand> MVCCEntry<K, V> acquireKeyFromContext(InvocationContext ctx, WCT command, Object key,
               TriPredicate<? super WCT, Object, MVCCEntry<?, ?>> commandKeyPredicate) {
            //noinspection unchecked
            MVCCEntry<K, V> entry = (MVCCEntry<K, V>) ctx.lookupEntry(key);
            if (commandKeyPredicate != null && !commandKeyPredicate.test(command, key, entry) || !entry.isChanged()) {
               return null;
            }
            return entry;
         }
      

      If InvocationContext.lookupEntry(...) returns null for the specified key, there are 2 possible NPEs:

      1. The entry.isChanged() call of this method
      2. If the commandKeyPredicate does not handle a null entry, e.g. the call to entry.isRemoved() from PassivationWriterInterceptor.store(...)

      See linked issue for an example of #2.

              wburns@redhat.com Will Burns
              pferraro@redhat.com Paul Ferraro
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: