Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-3263

Affinity function must check for null keys

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6
    • 1.8
    • None

    Description

      AffinityFunction implementations must check for null keys and through meaningful exceptions in such a cases.

      As an example the following code trows NPE since the keys is not validated

      Cache<AffinityKey&lt;String>, Person> personCache = ..;
      personCache.get(new AffinityKey<>(key, affKey)); // returns value
      personCache.get(new AffinityKey<>(key)); // throws NPE
      
      Exception in thread "main" java.lang.NullPointerException
              at
      org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction.partition(RendezvousAffinityFunction.java:428)
              at
      org.apache.ignite.internal.processors.cache.GridCacheAffinityManager.partition(GridCacheAffinityManager.java:206)
              at
      org.apache.ignite.internal.processors.cache.GridCacheContext.toCacheKeyObject(GridCacheContext.java:1801)
              at
      org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.get(GridDhtAtomicCache.java:339)
              at
      org.apache.ignite.internal.processors.cache.GridCacheAdapter.get(GridCacheAdapter.java:4650)
              at
      org.apache.ignite.internal.processors.cache.GridCacheAdapter.get(GridCacheAdapter.java:1391)
              at
      org.apache.ignite.internal.processors.cache.IgniteCacheProxy.get(IgniteCacheProxy.java:907)
              at
      my.apache.ignite.examples.collocation.CacheCollocationExample.main(CacheCollocationExample.java:69)
      

      Attachments

        Issue Links

          Activity

            People

              samaitra Saikat Maitra
              dmagda Denis A. Magda
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: