• Bug
  • Status: New
  • 2 Major
  • Resolution:
  • ehcache-core
  • interfaces
  • Reporter: adahanne
  • June 11, 2013
  • 0
  • Watchers: 5
  • February 20, 2014

Description

When you don’t configure maxBytesLocalDisk in your cache manager, the value of this property is null by default. Then, when the user tries to change it (using the rest agent for example) to “10M”, he will get a NPE in net.sf.ehcache.config.Configuration$DynamicProperty , l.163 :

            void applyChange(final PropertyChangeEvent evt, final RuntimeCfg config) {
                if ((Long)evt.getOldValue() > (Long)evt.getNewValue()) {
                    // Double check for over-allocation again
                    for (CacheConfiguration cacheConfiguration : config.getConfiguration().getCacheConfigurations().values()) {
                        cacheConfiguration.isMaxBytesLocalDiskPercentageSet();
                    }
                }
                config.cacheManager.getOnDiskPool().setMaxSize((Long) evt.getNewValue());
                // Recalculate % based caches ?
            }

with evt.getOldValue() being null. That said, even if we null check this, config.cacheManager.getOnDiskPool() few lines below is also null. I created this Jira since Alex and Gary’s reactions to this issue : {quote} Gary Keim 5:50 Another dynamic attribute that shouldn’t be? Alex 5:59 Anthony what is it with that NPE ? Alex 5:59 Alright, gotcha I think… Though probably the mutation isn’t a valid one anyways … {quote} leads me to think we could start a discussion on whether or not we want to continue to allow the mutation of this property

Comments