shinnlok/liferay-portal — pull request #78 by lipusz (2014-08-27 15:42:11+00:00)
Title: [TECHNICAL SUPPORT | September 2] LPS-49670 Cannot register custom DLProcessor (dl.file.entry.processor) from a hook: causes NPE

https://issues.liferay.com/browse/LPS-49670

Hi Shinn,

This is caused by this: liferay@b82b41f1d0c7d094091e3ebbf5a8148ae55149c2
I could not find a better way to overcome this, though, the pattern comes from

PortletDisplayTemplateImpl.java:

````java
@Override
public List getPortletDisplayTemplateHandlers() {
List templateHandlers =
TemplateHandlerRegistryUtil.getTemplateHandlers();

List portletDisplayTemplateHandlers =
new ArrayList();

for (TemplateHandler templateHandler : templateHandlers) {
if (templateHandler instanceof BasePortletDisplayTemplateHandler) {
portletDisplayTemplateHandlers.add(templateHandler);
}
else if (ProxyUtil.isProxyClass(templateHandler.getClass())) {
InvocationHandler invocationHandler =
ProxyUtil.getInvocationHandler(templateHandler);

if (invocationHandler instanceof ClassLoaderBeanHandler) {
ClassLoaderBeanHandler classLoaderBeanHandler =
(ClassLoaderBeanHandler)invocationHandler;

Object bean = classLoaderBeanHandler.getBean();

if (bean instanceof BasePortletDisplayTemplateHandler) {
portletDisplayTemplateHandlers.add(templateHandler);
}
}
}
}

return portletDisplayTemplateHandlers;
}
````

Regards,
Tibor