From 750f20903528c234ee4c39b8d958d1f392fb9a1f Mon Sep 17 00:00:00 2001 From: hns Date: Thu, 1 Apr 2004 15:39:06 +0000 Subject: [PATCH] Try ScriptRuntime.toString() in get() to work around unimplemented toString() in some Rhino native types. --- src/helma/scripting/rhino/RhinoEngine.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/helma/scripting/rhino/RhinoEngine.java b/src/helma/scripting/rhino/RhinoEngine.java index fb5ac5a0..1e5e9163 100644 --- a/src/helma/scripting/rhino/RhinoEngine.java +++ b/src/helma/scripting/rhino/RhinoEngine.java @@ -403,6 +403,17 @@ public class RhinoEngine implements ScriptingEngine { } else if (prop == Undefined.instance || prop == ScriptableObject.NOT_FOUND) { return null; } 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; } } catch (Exception esx) {