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:
parent
a70cf2feaf
commit
9e3d057aa8
1 changed files with 10 additions and 21 deletions
|
@ -327,28 +327,18 @@ public class HopObject extends ScriptableObject implements Wrapper {
|
|||
Object n = null;
|
||||
|
||||
if (id instanceof Number) {
|
||||
n = get(((Number) id).intValue(), this);
|
||||
n = node.getSubnodeAt(((Number) id).intValue());
|
||||
} 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());
|
||||
}
|
||||
|
||||
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 n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a child object by ID
|
||||
*
|
||||
|
@ -787,7 +777,6 @@ public class HopObject extends ScriptableObject implements Wrapper {
|
|||
IProperty p = node.get(name);
|
||||
|
||||
if (p != null) {
|
||||
|
||||
switch (p.getType()) {
|
||||
case IProperty.STRING:
|
||||
case IProperty.INTEGER:
|
||||
|
@ -893,13 +882,13 @@ public class HopObject extends ScriptableObject implements Wrapper {
|
|||
return new Object[0];
|
||||
}
|
||||
|
||||
Enumeration enum = node.properties();
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
checkNode();
|
||||
|
||||
while (enum.hasMoreElements())
|
||||
list.add(enum.nextElement());
|
||||
Enumeration en = node.properties();
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
while (en.hasMoreElements())
|
||||
list.add(en.nextElement());
|
||||
|
||||
return list.toArray();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue