Do not try to get JavaScript properties in jsFunction_get().

Renamed Enumeration because enum is a reserved word in Java 1.5
This commit is contained in:
hns 2004-01-14 16:35:27 +00:00
parent a70cf2feaf
commit 9e3d057aa8

View file

@ -327,28 +327,18 @@ public class HopObject extends ScriptableObject implements Wrapper {
Object n = null; Object n = null;
if (id instanceof Number) { if (id instanceof Number) {
n = get(((Number) id).intValue(), this); n = node.getSubnodeAt(((Number) id).intValue());
} else if (id != null) { } else if (id != null) {
// try to get as property first
n = getFromNode(id.toString());
// then try to get child object by id
if (n == null || n == NOT_FOUND) {
n = node.getChildElement(id.toString()); n = node.getChildElement(id.toString());
}
if (n != null) { if (n != null) {
n = Context.toObject(n, core.global); return Context.toObject(n, core.global);
}
}
} }
// since we're calling Scriptable.get() methods, we'll get NOT_FOUND rather
// than null if a property is not defined.
if (n == null || n == NOT_FOUND) {
return null; return null;
} }
return n;
}
/** /**
* Get a child object by ID * Get a child object by ID
* *
@ -787,7 +777,6 @@ public class HopObject extends ScriptableObject implements Wrapper {
IProperty p = node.get(name); IProperty p = node.get(name);
if (p != null) { if (p != null) {
switch (p.getType()) { switch (p.getType()) {
case IProperty.STRING: case IProperty.STRING:
case IProperty.INTEGER: case IProperty.INTEGER:
@ -893,13 +882,13 @@ public class HopObject extends ScriptableObject implements Wrapper {
return new Object[0]; return new Object[0];
} }
Enumeration enum = node.properties();
ArrayList list = new ArrayList();
checkNode(); checkNode();
while (enum.hasMoreElements()) Enumeration en = node.properties();
list.add(enum.nextElement()); ArrayList list = new ArrayList();
while (en.hasMoreElements())
list.add(en.nextElement());
return list.toArray(); return list.toArray();
} }