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().
This commit is contained in:
hns 2001-08-04 11:49:54 +00:00
parent 6cda9fc224
commit 59d49016f7
2 changed files with 19 additions and 2 deletions

View file

@ -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;
}

View file

@ -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 () {