Author: chris.laprun(a)jboss.com
Date: 2007-07-06 14:57:51 -0400 (Fri, 06 Jul 2007)
New Revision: 7689
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
Log:
- JBPORTAL-1541: check for null parent.
Modified:
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2007-07-06
18:56:20 UTC (rev 7688)
+++
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2007-07-06
18:57:51 UTC (rev 7689)
@@ -23,21 +23,21 @@
package org.jboss.portal.core.impl.model.portal;
import org.apache.log4j.Logger;
+import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.core.model.portal.DuplicatePortalObjectException;
import org.jboss.portal.core.model.portal.NoSuchPortalObjectException;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.common.NotYetImplemented;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
-import java.util.HashSet;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -211,7 +211,7 @@
else
{
int count = 0;
- for (Iterator i = iterator();i.hasNext();)
+ for (Iterator i = iterator(); i.hasNext();)
{
i.next();
count++;
@@ -280,7 +280,7 @@
{
ObjectNode childNode = (ObjectNode)iterator.next();
PortalObjectImpl childObject = childNode.getObject();
- if (mask == ALL_TYPES_MASK || (childObject.getMask() & mask) !=
0)
+ if (mask == ALL_TYPES_MASK || (childObject.getMask() & mask) != 0)
{
nextChild = childObject;
}
@@ -395,9 +395,7 @@
return accessedChildren;
}
- /**
- * Get the aggregated properties in a lazy manner.
- */
+ /** Get the aggregated properties in a lazy manner. */
public Map getProperties()
{
// Lazy compute properties
@@ -457,7 +455,13 @@
if (value == null)
{
declaredPropertyMap.remove(name);
- String parentValue = getParent().getProperty(name);
+ PortalObject parent = getParent();
+ String parentValue = null;
+ if (parent != null)
+ {
+ parentValue = parent.getProperty(name);
+ }
+
propagatePropertyUpdate(name, parentValue, true);
}
else
@@ -468,15 +472,15 @@
}
/**
- * This method propagates a property value update to descendants which have been
*loaded* from the database.
- * It considers that if the <code>properties</code> field of the runtime
state is null then it means that
- * the object is loaded but children have not made an attempt to read the properties
of this object. Indeed
- * if a child is loaded any attempt to access its aggregated properties will trigger
the computation of
- * the aggregated properties of this object.
- *
+ * This method propagates a property value update to descendants which have been
*loaded* from the database. It
+ * considers that if the <code>properties</code> field of the runtime
state is null then it means that the object is
+ * loaded but children have not made an attempt to read the properties of this object.
Indeed if a child is loaded
+ * any attempt to access its aggregated properties will trigger the computation of the
aggregated properties of this
+ * object.
+ * <p/>
* Null property values are considered as removal
*
- * @param name the property name
+ * @param name the property name
* @param value the new property value
* @param force the update
*/
@@ -561,9 +565,7 @@
protected abstract PortalObjectImpl cloneObject();
- /**
- * Overridable callback.
- */
+ /** Overridable callback. */
protected void destroy()
{
}
@@ -573,9 +575,7 @@
return getMask(getType());
}
- /**
- * Returns the mask for this kind of object.
- */
+ /** Returns the mask for this kind of object. */
protected final int getMask(int portalObjectType)
{
switch (portalObjectType)
@@ -639,7 +639,7 @@
// Clone children recursively
if (deep)
{
- for (Iterator i = getChildren().iterator();i.hasNext();)
+ for (Iterator i = getChildren().iterator(); i.hasNext();)
{
PortalObjectImpl child = (PortalObjectImpl)i.next();
@@ -651,6 +651,4 @@
//
return clone;
}
-}
-
-
+}
\ No newline at end of file
Show replies by date