Author: julien_viet
Date: 2010-01-26 05:23:31 -0500 (Tue, 26 Jan 2010)
New Revision: 1447
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/Lifecycle.java
Log:
GTNPORTAL-556: Throw detailled IllegalStateException when a uicomponent does not have an
assigned template at rendering time
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java 2010-01-26
07:53:01 UTC (rev 1446)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIComponent.java 2010-01-26
10:23:31 UTC (rev 1447)
@@ -205,7 +205,7 @@
public String getTemplate()
{
- return config.getTemplate();
+ return config != null ? config.getTemplate() : null;
}
public ResourceResolver getTemplateResourceResolver(WebuiRequestContext context,
String template)
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/Lifecycle.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/Lifecycle.java 2010-01-26
07:53:01 UTC (rev 1446)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/Lifecycle.java 2010-01-26
10:23:31 UTC (rev 1447)
@@ -69,6 +69,15 @@
public void processRender(E uicomponent, WebuiRequestContext context) throws
Exception
{
String template = uicomponent.getTemplate();
+
+ // Fail if we have no template
+ if (template == null)
+ {
+ throw new IllegalStateException("uicomponent " + uicomponent + "
with class " + uicomponent.getClass().getName() +
+ " has no template for rendering");
+ }
+
+ //
ResourceResolver resolver = uicomponent.getTemplateResourceResolver(context,
template);
WebuiBindingContext bcontext = new WebuiBindingContext(resolver,
context.getWriter(), uicomponent, context);
bcontext.put(UIComponent.UICOMPONENT, uicomponent);
Show replies by date