Antoine Herzog created GTNPORTAL-2528:
-----------------------------------------
Summary: Page building : Better error message when gadget definition not
found
Key: GTNPORTAL-2528
URL:
https://issues.jboss.org/browse/GTNPORTAL-2528
Project: GateIn Portal
Issue Type: Enhancement
Security Level: Public (Everyone can see)
Components: Management
Affects Versions: 3.2.0-GA
Reporter: Antoine Herzog
Priority: Minor
This is for the creation of pages with the XML configuration.
When a page is created, with a gadget inside that does not exist, the exception message is
not clear at all.
Reproduce : with xml configuration (portal extension), create a page, and add in it a
gadget named "MyGadget". If the "MyGadget" does not exist in the
gadget definition, then you have this exception when calling the page.
Note : This is not about the problems with URL of the gadget, or other JIRA yet resolved.
This is when adding a Gadget in a page, in the XML page definition.
The exception :
************************************************************
Aug 1, 2012 4:43:32 PM org.exoplatform.portal.webui.application.UIPortletLifecycle
processRender
SEVERE: Portlet render threw an exception
org.exoplatform.services.portletcontainer.PortletContainerException:
java.lang.NullPointerException
at
org.exoplatform.portal.webui.application.UIPortletLifecycle.processRender(UIPortletLifecycle.java:340)
at
org.exoplatform.portal.webui.application.UIPortletLifecycle.processRender(UIPortletLifecycle.java:62)
at org.exoplatform.webui.core.UIComponent.processRender(UIComponent.java:144)
at org.exoplatform.webui.core.UIContainer.renderChildren(UIContainer.java:368)
at org.exoplatform.webui.core.UIContainer.renderChildren(UIContainer.java:358)
at sun.reflect.GeneratedMethodAccessor198.invoke(Unknown Source)
.....
Caused by: java.lang.NullPointerException
at
org.exoplatform.portal.webui.application.ModelAdapter$2.getPortletContext(ModelAdapter.java:204)
at
org.exoplatform.portal.webui.application.UIPortlet.getPortletContext(UIPortlet.java:997)
at org.exoplatform.portal.webui.application.UIPortlet.create(UIPortlet.java:833)
at
org.exoplatform.portal.webui.application.UIPortletLifecycle.processRender(UIPortletLifecycle.java:212)
... 217 more
************************************************************
The problem :
Caused by: java.lang.NullPointerException
at
org.exoplatform.portal.webui.application.ModelAdapter$2.getPortletContext(ModelAdapter.java:204)
this message is not clear.
The code in the ModelAdapter is :
GadgetRegistryService gadgetService =
(GadgetRegistryService)container.getComponentInstanceOfType(GadgetRegistryService.class);
org.exoplatform.application.gadget.Gadget model = gadgetService.getGadget(applicationId);
String url = GadgetUtil.reproduceUrl(model.getUrl(), model.isLocal());
As "model" is not found, then the model.getUrl() throws the NPE Exception.
**************
Suggestion of code :
- make a test after the line :
model = gadgetService.getGadget(applicationId);
- if "model" is null, then throw an exception with a message such as :
"The gadget is not found. Check that it has been declared. Gadget Id is : " +
applicationId
- the best would be to provide the info such as : the portal container name, the real
name of the Gadget, etc....
At least, giving the information that it is a problem with the Gadget definition is yet
nice for the developer.
Thanks,
Antoine
www.sysemo.com
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira