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,26 +327,16 @@ 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 = node.getChildElement(id.toString());
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// since we're calling Scriptable.get() methods, we'll get NOT_FOUND rather
|
if (n != null) {
|
||||||
// than null if a property is not defined.
|
return Context.toObject(n, core.global);
|
||||||
if (n == null || n == NOT_FOUND) {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return n;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue