Hi,

We configured the log4j category 'sitemap' to log in DEBUG-mode, but the result 
was a NullpointerException in ResourceExistsSelectorEventAware. The crash 
occurs on the last line in the example below:

if (cacheKey != null && this.getLogger().isDebugEnabled()) {
 this.getLogger().debug("looking for cached key: " + cacheKey);
 this.getLogger().debug("Cache key hit: " + cache.containsKey(cacheKey));
 this.getLogger().debug("cache: <map:when test='" + 
(cache.get(cacheKey).getResponse()[0] == 1) + "'>");
}

The crash occurs when the cacheKey is not in the cache. I suggest this fix, 
which works correctly for me:

if (cacheKey != null && this.getLogger().isDebugEnabled()) {
 this.getLogger().debug("looking for cached key: " + cacheKey);
 boolean cacheHit = cache.containsKey(cacheKey);
 this.getLogger().debug("Cache key hit: " + cacheHit);
 if (cacheHit) {
  this.getLogger().debug("cache: <map:when test='" + 
(cache.get(cacheKey).getResponse()[0] == 1) + "'>");
 }
}

Regards,

Wouter

<<winmail.dat>>

********************************************
Hippocms-dev: Hippo CMS development public mailinglist

Reply via email to