I implemented the context factory .
I still get
Java heap space
!!!!![ERROR] java.lang.OutOfMemoryError: Java heap space
at java.lang.String.concat(String.java:1831)
at org.mozilla.javascript.Interpreter.do_add(Interpreter.java:4019)
at
org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:2761)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2251)
at
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:161)
at
com.adobe.internal.pdftoolkit.services.javascript.security.JSSecurityController$1.run(JSSecurityController.java:96)
at java.security.AccessController.doPrivileged(Native Method)
at
com.adobe.internal.pdftoolkit.services.javascript.security.JSSecurityController.callWithDomain(JSSecurityController.java:100)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2240)
at
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:161)
at
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
at
com.adobe.internal.pdftoolkit.services.javascript.MyFactory.doTopCall(MyFactory.java:84)
Can I avoid the exception?
Thanks
-Anupama
On Thu, Feb 5, 2009 at 11:03 AM, Patrick Dobbs <
[email protected]> wrote:
> I think you need to define a Context (in Java) which checks that scripts
> are behaving sensibly:
>
>
> http://www.mozilla.org/rhino/apidocs/org/mozilla/javascript/ContextFactory.html
>
>
>
> Marcello Bastéa-Forte wrote:
>
>> you could catch the exception:
>> try {
>> ... execute javascript ...
>> } catch (OutOfMemoryError ex) {
>> ... do what you want to do ...
>> }
>>
>> Marcello
>>
>> On Wed, Feb 4, 2009 at 11:59 AM, Rhino user <[email protected]>
>> wrote:
>>
>> My script looks like this -
>>> var i = "0";
>>>
>>> init("A qucik brown fox jumps over the lazy dog A qucik brown fox
>>> jumps over the lazy dog A qucik brown fox jumps over the lazy dog A
>>> qucik brown fox jumps over the lazy dog A qucik brown fox jumps over
>>> the lazy dog A qucik brown fox jumps over the lazy dog A qucik brown
>>> fox jumps over the lazy dog A qucik brown fox jumps over the lazy dog
>>> A qucik brown fox jumps over the lazy dog A qucik brown fox jumps over
>>> the lazy dog A qucik brown fox jumps over the lazy dog A qucik brown
>>> fox jumps over the lazy dog A qucik brown fox jumps over the lazy dog
>>> A qucik brown fox jumps over the lazy dog A qucik brown fox jumps over
>>> the lazy dog A qucik brown fox jumps over the lazy dog A qucik brown
>>> A qucik brown fox jumps over the lazy dog A qucik brown fox jumps over
>>> the lazy dog A qucik brown fox jumps over the lazy dog A qucik brown
>>> fox jumps over the lazy dog A qucik brown fox jumps over the lazy dog
>>> A qucik brown fox jumps over the lazy dog A qucik brown fox jumps over
>>> the lazy dog A qucik brown fox jumps over the lazy dog A qucik brown
>>> fox jumps over the lazy dog A qucik brown fox jumps over the lazy dog
>>> A qucik brown fox jumps over the lazy dog A qucik brown fox jumps over
>>> the lazy dog A qucik brown fox jumps over the lazy dog ");
>>>
>>> function init(s)
>>> {
>>> while(i=="0")
>>> s+=s;
>>> }
>>>
>>> I get
>>> ava.lang.OutOfMemoryError: Java heap space
>>> at java.lang.String.concat(String.java:1831)
>>> at
>>> org.mozilla.javascript.ScriptRuntime.add(ScriptRuntime.java:2296)
>>> at org.mozilla.javascript.gen.c3._c1(externalScript:11)
>>> at org.mozilla.javascript.gen.c3.call(externalScript)
>>>
>>> How can I avoid it?
>>> Thanks
>>> -Anupama
>>> _______________________________________________
>>> 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