-
Notifications
You must be signed in to change notification settings - Fork 871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot find function split in object #345
Comments
This works for me. What version of Rhino are you running? I don't recall how long "split" has been in the code base. |
its failing when all the variables are global scope. we are using 1.7.7.2 |
I can't reproduce it either. @deepakmalode Could you please share the code where you're setting up Rhino? Does this also happen if you run your code from Rhino's Shell (something like What is printed out if you add print(c.toSource());
print(String.prototype.split.toSource()); before |
you are right. The error was due to we using rhino through ScriptEngine through com.sun.phobos:com.sun.phobos package. This issue does not occur when we use rhino directly. Guess something in there is introducing the problem . Thanks for the active response and support !!! |
Glad to hear that it's working better for you! |
following js code is throwing exception saying "TypeError: Cannot find function split in object".
var a = "test";
var b = "case";
var c = a + ':' + b;
var d = c.split(':');
Following is the complete stack trace
Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot find function split in object test:case. (#6)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:4142)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:4120)
at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:4153)
at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:4172)
at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:4244)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2533)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2515)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1322)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:399)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3452)
at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:120)
at org.mozilla.javascript.Context.evaluateReader(Context.java:1275)
The text was updated successfully, but these errors were encountered: