Fixed a few bugs caused by bad argument checking, mostly
null that should have been Undefined.instance.
This commit is contained in:
parent
cd10424299
commit
99a0c1ea84
1 changed files with 7 additions and 7 deletions
|
@ -267,7 +267,7 @@ public class HopObject extends ScriptableObject implements Wrapper {
|
||||||
* @return ...
|
* @return ...
|
||||||
*/
|
*/
|
||||||
public Object jsFunction_get(Object id) {
|
public Object jsFunction_get(Object id) {
|
||||||
if ((node == null) || (id == null)) {
|
if ((node == null) || (id == null) || id == Undefined.instance) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,7 +409,7 @@ public class HopObject extends ScriptableObject implements Wrapper {
|
||||||
public boolean jsFunction_remove(Object child) {
|
public boolean jsFunction_remove(Object child) {
|
||||||
// semantics: if called without arguments, remove self.
|
// semantics: if called without arguments, remove self.
|
||||||
// otherwise, remove given subnodes.
|
// otherwise, remove given subnodes.
|
||||||
if (child == null) {
|
if (child == Undefined.instance) {
|
||||||
return node.remove();
|
return node.remove();
|
||||||
} else if (node != null) {
|
} else if (node != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -434,12 +434,12 @@ public class HopObject extends ScriptableObject implements Wrapper {
|
||||||
/**
|
/**
|
||||||
* Invalidate the node itself or a subnode
|
* Invalidate the node itself or a subnode
|
||||||
*/
|
*/
|
||||||
public boolean jsFunction_invalidate(String childId) {
|
public boolean jsFunction_invalidate(Object childId) {
|
||||||
if (node instanceof helma.objectmodel.db.Node) {
|
if (childId != null && node instanceof helma.objectmodel.db.Node) {
|
||||||
if (childId == null) {
|
if (childId == Undefined.instance) {
|
||||||
((helma.objectmodel.db.Node) node).invalidate();
|
((helma.objectmodel.db.Node) node).invalidate();
|
||||||
} else {
|
} else {
|
||||||
((helma.objectmodel.db.Node) node).invalidateNode(childId);
|
((helma.objectmodel.db.Node) node).invalidateNode(childId.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,7 +450,7 @@ public class HopObject extends ScriptableObject implements Wrapper {
|
||||||
* Check if node is contained in subnodes
|
* Check if node is contained in subnodes
|
||||||
*/
|
*/
|
||||||
public int jsFunction_contains(Object obj) {
|
public int jsFunction_contains(Object obj) {
|
||||||
if ((node != null) && (obj != null) && obj instanceof HopObject) {
|
if ((node != null) && obj instanceof HopObject) {
|
||||||
return node.contains(((HopObject) obj).node);
|
return node.contains(((HopObject) obj).node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue