From 59d49016f7c490cbcbe5c4e5cfcb0469696e8c79 Mon Sep 17 00:00:00 2001 From: hns Date: Sat, 4 Aug 2001 11:49:54 +0000 Subject: [PATCH] Fixed bugs related to ESNodes with transient nodes (i.e. instances of class helma.objectmodel.Node where no NodeHandle is used). The bugs were in ESNode.equals() and ESUser.logout(). --- src/helma/framework/core/ESNode.java | 16 ++++++++++++++-- src/helma/framework/core/ESUser.java | 5 +++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/helma/framework/core/ESNode.java b/src/helma/framework/core/ESNode.java index 730c3cfc..3bf44edf 100644 --- a/src/helma/framework/core/ESNode.java +++ b/src/helma/framework/core/ESNode.java @@ -43,6 +43,8 @@ public class ESNode extends ObjectPrototype { // set node handle to wrapped node if (node instanceof helma.objectmodel.db.Node) handle = ((helma.objectmodel.db.Node) node).getHandle (); + else + handle = null; } public ESNode (ESObject prototype, Evaluator evaluator, Object obj, RequestEvaluator eval) { @@ -60,6 +62,8 @@ public class ESNode extends ObjectPrototype { // set node handle to wrapped node if (node instanceof helma.objectmodel.db.Node) handle = ((helma.objectmodel.db.Node) node).getHandle (); + else + handle = null; // get transient cache Node cache = node.getCacheNode (); @@ -87,6 +91,8 @@ public class ESNode extends ObjectPrototype { // set node handle to wrapped node if (node instanceof helma.objectmodel.db.Node) handle = ((helma.objectmodel.db.Node) node).getHandle (); + else + handle = null; eval.objectcache.put (node, this); // get transient cache Node cache = node.getCacheNode (); @@ -351,8 +357,11 @@ public class ESNode extends ObjectPrototype { } private ESValue getInternalProperty (String propertyName) throws EcmaScriptException { - if ("__id__".equalsIgnoreCase (propertyName)) + if ("__id__".equalsIgnoreCase (propertyName)) try { return new ESString (node.getID ()); + } catch (Exception noid) { + return new ESString ("transient"); + } if ("__prototype__".equalsIgnoreCase (propertyName)) { String p = node.getPrototype (); if (p == null) @@ -415,7 +424,10 @@ public class ESNode extends ObjectPrototype { return true; if (what instanceof ESNode) { ESNode other = (ESNode) what; - return (other.handle.equals (handle)); + if (handle != null) + return handle.equals (other.handle); + else + return (node == other.node); } return false; } diff --git a/src/helma/framework/core/ESUser.java b/src/helma/framework/core/ESUser.java index cf39a1ef..db1d2f63 100644 --- a/src/helma/framework/core/ESUser.java +++ b/src/helma/framework/core/ESUser.java @@ -70,6 +70,8 @@ public class ESUser extends ESNode { // set node handle to wrapped node if (node instanceof helma.objectmodel.db.Node) handle = ((helma.objectmodel.db.Node) node).getHandle (); + else + handle = null; // we don't take over the transient cache from the node, // because we always use the one from the user object. } @@ -79,6 +81,9 @@ public class ESUser extends ESNode { // set node handle to wrapped node if (node instanceof helma.objectmodel.db.Node) handle = ((helma.objectmodel.db.Node) node).getHandle (); + else + handle = null; + } public String toString () {