From 8e71110ad470e38659e448ffd732b7e353f56957 Mon Sep 17 00:00:00 2001 From: hns Date: Thu, 30 Nov 2006 21:04:44 +0000 Subject: [PATCH] * Avoid setting parent in setNode() if the property name isn't persistable. --- src/helma/objectmodel/db/Node.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/helma/objectmodel/db/Node.java b/src/helma/objectmodel/db/Node.java index 74bc63c1..3cd71f49 100644 --- a/src/helma/objectmodel/db/Node.java +++ b/src/helma/objectmodel/db/Node.java @@ -2314,8 +2314,9 @@ public final class Node implements INode, Serializable { throw new RuntimeException("Can't add fixed-transient node to a persistent node"); } + boolean isPersistable = isPersistableProperty(propname); // if the new node is marked as TRANSIENT and this node is not, mark new node as NEW - if (state != TRANSIENT && n.state == TRANSIENT && isPersistableProperty(propname)) { + if (state != TRANSIENT && n.state == TRANSIENT && isPersistable) { n.makePersistable(); } @@ -2325,7 +2326,7 @@ public final class Node implements INode, Serializable { // check if the main identity of this node is as a named property // or as an anonymous node in a collection - if (n != this && !nmgr.isRootNode(n)) { + if (n != this && !nmgr.isRootNode(n) && isPersistable) { // avoid calling getParent() because it would return bogus results // for the not-anymore transient node Node nparent = (n.parentHandle == null) ? null @@ -2390,7 +2391,7 @@ public final class Node implements INode, Serializable { propMap.put(p2, prop); - if (state == CLEAN && isPersistableProperty(propname)) { + if (state == CLEAN && isPersistable) { markAs(MODIFIED); } }