Thanks to all who tried to help.
The reason for my trouble was: No Context associated with current Thread
That is the exception I got when trying to call a string function. Even
for a string that was initialized within the script, and thus did not
come from outside (Java).
I was trying to call functions in the same script in a multithreaded
manner and threfore provoked the above error. Apparently this was not a
good idea.
Regards,
Stu
Marcello Bastéa-Forte wrote:
It might help to describe how it "dies." Are you getting an exception? Is
the app freezing? Is it stuck in an infinite loop or deadlock?
Do you know exactly which line it's dying on?
Marcello
On Wed, Apr 22, 2009 at 2:13 PM, Stu <[email protected]> wrote:
Thanks for your response.
No, I did not do anything with prototypes.
I'm using js-14.jar. Is there any chance of this prototype stuff being
messed up by somme kind of config? Or by any other JAR (from other libs)
that might interfere?
Can you explain how exactly you do this with the shell, so I can verify
that here?
No, I didn't change "this", I wouldn't know how..
No I didn't use the Rhino debugger (shame).
Is that like a mode I can activate by config and it would log to System.out
?
I am sure I'm not using Java Strings, as it even breaks when i create a var
in the script, as in my example.
I did try it by explicitly instancing a new Java String, but the result is
the same. The script dies.
Getting blah.length DOES work, maybe because it's not a function... ?
out is an object from my Java app, which is introduced into the script
context and it just loggs the text it is given.
I'm grateful for any further ideas and info :)
- Stu
Terry Braun wrote:
don't have an answer for you, but somethings to think about
did you change the prototype for string somehow? because just doing plain
rhino I can do the middle two lines and it works in the shell.
did you change "this" somehow?
did you run it in the debugger?
are you sure that somehow you are not getting java strings
does blah.length work or blah.length();
can you give an idea of what out.chat does
Stu wrote:
I should add, I have been using Rhino for quite a while now, doing
complex asynchronous, event driven scripts. Using lots of Java objects from
the environment, etc. Quite the heavy stuff.
But calling functions on string vars just won't work...
- Stu
Stu wrote:
Hi Everyone :)
I have the problem that my script dies whenever i try to do something on
a string var, like substring(), charAt() or indexOf().
The following is my very simple text:
out.chat("bluh");
var blah = "sjkdjhgv ksdhgf";
var widuh = blah.indexOf("s"); //blah.charAt(5);
out.chat("bluh "+widuh);
The out.chat command is from my environment and works under any
circumstances. The first text "bluh" is printed out.
But on line 3, the script halts.
Has this problem been seen before with Rhino?
Thanks & Greetings,
Stu
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino