Hi,

I've noticed something strange in the code of MarkupCache and
DefaultMarkupCacheKeyProvider. In MarkupCache#getMarkup there is a
verification that the given clazz parameter is null:

if (clazz == null)
{
    containerClass = container.getClass();
}


Then this same clazz parameter is used with getCacheKey on the
IMarkupCacheKeyProvider implementation returned by
getMarkupCacheKeyProvider().

final String cacheKey =
getMarkupCacheKeyProvider(container).getCacheKey(container, clazz);


But in DefaultMarkupCacheKeyProvider (the default implementation), a method
is called on the given clazz parameter:

final String classname = clazz.getName();

So IMHO either the check for clazz nullity in MarkupCache is not necessary,
or DefaultMarkupCacheKeyProvider#getCacheKey() should be defensive against
null clazz, or getCacheKey shouldn't be called with clazz (and maybe rather
with containerClass).

Am I missing something?

Xavier
-- 
Xavier Hanin - Independent Java Consultant
http://xhab.blogspot.com/
http://incubator.apache.org/ivy/
http://www.xoocode.org/

Reply via email to