Try ScriptRuntime.toString() in get() to work around unimplemented toString()
in some Rhino native types.
This commit is contained in:
parent
fbf6dfe693
commit
750f209035
1 changed files with 11 additions and 0 deletions
|
@ -403,6 +403,17 @@ public class RhinoEngine implements ScriptingEngine {
|
||||||
} else if (prop == Undefined.instance || prop == ScriptableObject.NOT_FOUND) {
|
} else if (prop == Undefined.instance || prop == ScriptableObject.NOT_FOUND) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
// not all Rhino types convert to a string as expected
|
||||||
|
// when calling toString() - try to do better by using
|
||||||
|
// Rhino's ScriptRuntime.toString(). Note that this
|
||||||
|
// assumes that people always use this method to get
|
||||||
|
// a string representation of the object - which is
|
||||||
|
// currently the case since it's only used in Skin rendering.
|
||||||
|
try {
|
||||||
|
return ScriptRuntime.toString(prop);
|
||||||
|
} catch (Exception x) {
|
||||||
|
// just return original property object
|
||||||
|
}
|
||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
} catch (Exception esx) {
|
} catch (Exception esx) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue