diff --git a/src/com/serotonin/mango/rt/dataSource/meta/ScriptExecutor.java b/src/com/serotonin/mango/rt/dataSource/meta/ScriptExecutor.java index 7b122fa067..8dc5370f8a 100644 --- a/src/com/serotonin/mango/rt/dataSource/meta/ScriptExecutor.java +++ b/src/com/serotonin/mango/rt/dataSource/meta/ScriptExecutor.java @@ -167,10 +167,7 @@ public PointValueTime execute(String script, if (o == null) result = null; else { - if (o instanceof NativeJavaObject) { - NativeJavaObject nativeJavaObject = (NativeJavaObject)o; - result = nativeJavaObject.getDefaultValue(String.class); - } else if (!(o instanceof AbstractPointWrapper)) { + if (!(o instanceof AbstractPointWrapper)) { result = o.toString(); } else { result = o; diff --git a/src/org/scada_lts/scripting/SandboxNativeJavaObject.java b/src/org/scada_lts/scripting/SandboxNativeJavaObject.java index a1cc925760..b7af25ff2d 100644 --- a/src/org/scada_lts/scripting/SandboxNativeJavaObject.java +++ b/src/org/scada_lts/scripting/SandboxNativeJavaObject.java @@ -71,4 +71,8 @@ public Object get(String methodName, Scriptable start) { return NOT_FOUND; } + @Override + public String toString() { + return String.valueOf(super.getDefaultValue(String.class)); + } }