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:
parent
6cda9fc224
commit
59d49016f7
2 changed files with 19 additions and 2 deletions
|
@ -43,6 +43,8 @@ public class ESNode extends ObjectPrototype {
|
||||||
// set node handle to wrapped node
|
// set node handle to wrapped node
|
||||||
if (node instanceof helma.objectmodel.db.Node)
|
if (node instanceof helma.objectmodel.db.Node)
|
||||||
handle = ((helma.objectmodel.db.Node) node).getHandle ();
|
handle = ((helma.objectmodel.db.Node) node).getHandle ();
|
||||||
|
else
|
||||||
|
handle = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ESNode (ESObject prototype, Evaluator evaluator, Object obj, RequestEvaluator eval) {
|
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
|
// set node handle to wrapped node
|
||||||
if (node instanceof helma.objectmodel.db.Node)
|
if (node instanceof helma.objectmodel.db.Node)
|
||||||
handle = ((helma.objectmodel.db.Node) node).getHandle ();
|
handle = ((helma.objectmodel.db.Node) node).getHandle ();
|
||||||
|
else
|
||||||
|
handle = null;
|
||||||
|
|
||||||
// get transient cache Node
|
// get transient cache Node
|
||||||
cache = node.getCacheNode ();
|
cache = node.getCacheNode ();
|
||||||
|
@ -87,6 +91,8 @@ public class ESNode extends ObjectPrototype {
|
||||||
// set node handle to wrapped node
|
// set node handle to wrapped node
|
||||||
if (node instanceof helma.objectmodel.db.Node)
|
if (node instanceof helma.objectmodel.db.Node)
|
||||||
handle = ((helma.objectmodel.db.Node) node).getHandle ();
|
handle = ((helma.objectmodel.db.Node) node).getHandle ();
|
||||||
|
else
|
||||||
|
handle = null;
|
||||||
eval.objectcache.put (node, this);
|
eval.objectcache.put (node, this);
|
||||||
// get transient cache Node
|
// get transient cache Node
|
||||||
cache = node.getCacheNode ();
|
cache = node.getCacheNode ();
|
||||||
|
@ -351,8 +357,11 @@ public class ESNode extends ObjectPrototype {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ESValue getInternalProperty (String propertyName) throws EcmaScriptException {
|
private ESValue getInternalProperty (String propertyName) throws EcmaScriptException {
|
||||||
if ("__id__".equalsIgnoreCase (propertyName))
|
if ("__id__".equalsIgnoreCase (propertyName)) try {
|
||||||
return new ESString (node.getID ());
|
return new ESString (node.getID ());
|
||||||
|
} catch (Exception noid) {
|
||||||
|
return new ESString ("transient");
|
||||||
|
}
|
||||||
if ("__prototype__".equalsIgnoreCase (propertyName)) {
|
if ("__prototype__".equalsIgnoreCase (propertyName)) {
|
||||||
String p = node.getPrototype ();
|
String p = node.getPrototype ();
|
||||||
if (p == null)
|
if (p == null)
|
||||||
|
@ -415,7 +424,10 @@ public class ESNode extends ObjectPrototype {
|
||||||
return true;
|
return true;
|
||||||
if (what instanceof ESNode) {
|
if (what instanceof ESNode) {
|
||||||
ESNode other = (ESNode) what;
|
ESNode other = (ESNode) what;
|
||||||
return (other.handle.equals (handle));
|
if (handle != null)
|
||||||
|
return handle.equals (other.handle);
|
||||||
|
else
|
||||||
|
return (node == other.node);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,8 @@ public class ESUser extends ESNode {
|
||||||
// set node handle to wrapped node
|
// set node handle to wrapped node
|
||||||
if (node instanceof helma.objectmodel.db.Node)
|
if (node instanceof helma.objectmodel.db.Node)
|
||||||
handle = ((helma.objectmodel.db.Node) node).getHandle ();
|
handle = ((helma.objectmodel.db.Node) node).getHandle ();
|
||||||
|
else
|
||||||
|
handle = null;
|
||||||
// we don't take over the transient cache from the node,
|
// we don't take over the transient cache from the node,
|
||||||
// because we always use the one from the user object.
|
// 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
|
// set node handle to wrapped node
|
||||||
if (node instanceof helma.objectmodel.db.Node)
|
if (node instanceof helma.objectmodel.db.Node)
|
||||||
handle = ((helma.objectmodel.db.Node) node).getHandle ();
|
handle = ((helma.objectmodel.db.Node) node).getHandle ();
|
||||||
|
else
|
||||||
|
handle = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString () {
|
public String toString () {
|
||||||
|
|
Loading…
Add table
Reference in a new issue