Issue #2361 - CachingWebAppClassLoader using cache properly

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2018-03-20 09:30:31 -05:00
parent afd0677719
commit 9c68b141ba
1 changed files with 6 additions and 3 deletions

View File

@ -64,23 +64,26 @@ public class CachingWebAppClassLoader extends WebAppClassLoader
}
URL url = _cache.get(name);
if (name==null)
if (url == null)
{
// Not found in cache, try parent
url = super.getResource(name);
if (url==null)
{
// Still not found, cache the not-found result
if (LOG.isDebugEnabled())
LOG.debug("Caching not found resource {}",name);
_notFound.add(name);
}
else
{
// Cache the new result
_cache.putIfAbsent(name,url);
}
}
return url;
}