You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by "Elliot Metsger (JIRA)" <pl...@jakarta.apache.org> on 2005/06/05 20:58:39 UTC
[jira] Commented: (PLUTO-130) PortletApplicationEntity.getPortletApplicationDefinition() causes NPE when the portletentityregistry.xml references a portlet that doesn't exist.
[ http://issues.apache.org/jira/browse/PLUTO-130?page=comments#action_12312694 ]
Elliot Metsger commented on PLUTO-130:
--------------------------------------
Here is a patch against PortletApplicationEnittyImpl.java, r35916
Index: D:/eclipse-workspace/PlutoMselTrunk/portal/src/java/org/apache/pluto/portalImpl/om/entity/impl/PortletApplicationEntityImpl.java
===================================================================
--- D:/eclipse-workspace/PlutoMselTrunk/portal/src/java/org/apache/pluto/portalImpl/om/entity/impl/PortletApplicationEntityImpl.java (revision 887)
+++ D:/eclipse-workspace/PlutoMselTrunk/portal/src/java/org/apache/pluto/portalImpl/om/entity/impl/PortletApplicationEntityImpl.java (working copy)
@@ -56,8 +56,25 @@
public PortletApplicationDefinition getPortletApplicationDefinition()
{
- return PortletDefinitionRegistry.getPortletApplicationDefinitionList().get(
+
+ PortletApplicationDefinition appDef = PortletDefinitionRegistry.getPortletApplicationDefinitionList().get(
org.apache.pluto.portalImpl.util.ObjectID.createFromString(definitionId));
+
+ /*
+ * According to org.apache.pluto.om.entity.PortletApplicationEntity#getPortletApplicationDefintion() we can't return null.
+ * However, if the PortletEntity doesn't have a corresponding PortletDefinition (for example when the entity registry references
+ * a non-existant portlet) NPEs may be thrown by calling classes.
+ * (e.g. o.a.p.portalImpl.om.entity.impl.PortletApplicationEntity#getPortletApplicationDefinition()).
+ *
+ * So throw an exception here if the PortletApplicationDefinition cannot be found.
+ */
+ if ( appDef == null ) {
+ throw new NullPointerException(
+ "No PortletApplicationDefinition could be loaded for PortletEntity " + definitionId + ". " +
+ "Perhaps a portlet has been defined in the portlet registry that doesn't exist or hasn't been deployed." );
+ }
+
+ return appDef;
}
// additional methods.
> PortletApplicationEntity.getPortletApplicationDefinition() causes NPE when the portletentityregistry.xml references a portlet that doesn't exist.
> -------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: PLUTO-130
> URL: http://issues.apache.org/jira/browse/PLUTO-130
> Project: Pluto
> Type: Improvement
> Components: portal driver
> Versions: 1.0.1-rc3
> Environment: Sun JDK 1.4.2
> Reporter: Elliot Metsger
> Priority: Minor
>
> For example if the portletentityregistry.xml defines an entity that doesn't exist, currently an NPE is thrown in o.a.p.portalImpl.om.entity.impl.PortletEntityImpl's getPortletDefinition() method (because the PortletApplicationEntity cannot load the corresponding - non-existant - PortletApplicatonDefinition).
> Can we throw an explicit NPE containing an error message?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira