APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

EJsS Error post and replies

Return to the EJsS Error thread
Login to post to this thread

Error including line segments in EJsS
Spencer Wheaton
6 Posts

Hi there!

I am struggling to see what is wrong with the code attached. The problem is with the last line segment "segment2" that has sizeX and sizeY related to variables h and f. When I make the sizes constants then the problem disappears.  Also removing some of the other segments in the drawingPanel makes the problem go away.

Attached File: ejss_src_DivergingLensRealImage.zip


Replies to Error including line segments in EJsS

Re: Error including line segments in EJsS -
Francisco Esquembre
238 Posts

Hi Spencer,

What is the problem, exactly? I don't know what it is supposed to do, but it seems to me it does what is expected. I mean that, if I change the size of the object using the second slider, the arrow honours the change...

Paco



Re: Re: Error including line segments in EJsS -
Spencer Wheaton
6 Posts

Hi Paco

Sorry, I didn't explain very well at all. On my machine, if I try to run the code in a browser then I get the following errors:


Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
at org.mozilla.javascript.NativeArray.setLength(NativeArray.java:640)
at org.mozilla.javascript.NativeArray.setInstanceIdValue(NativeArray.java:129)
at org.mozilla.javascript.IdScriptableObject.put(IdScriptableObject.java:362)
at org.mozilla.javascript.NativeArray.put(NativeArray.java:387)
at org.mozilla.javascript.ScriptableObject.putProperty(ScriptableObject.java:2347)
at org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1598)
at org.mozilla.javascript.NativeArray.setLengthProperty(NativeArray.java:712)
at org.mozilla.javascript.NativeArray.js_slice(NativeArray.java:1432)
at org.mozilla.javascript.NativeArray.execIdCall(NativeArray.java:305)
at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:97)
at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2430)
at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:269)
at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:97)
at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
at org.mozilla.javascript.gen.JSUGLIFY_19._c_slice_106(JSUGLIFY:1325)
at org.mozilla.javascript.gen.JSUGLIFY_19.call(JSUGLIFY)
at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
at org.mozilla.javascript.gen.JSUGLIFY_19._c_anonymous_149(JSUGLIFY:1506)
at org.mozilla.javascript.gen.JSUGLIFY_19.call(JSUGLIFY)
at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2430)
at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:269)
at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:97)
at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
at org.mozilla.javascript.gen.JSUGLIFY_19._c_walk_154(JSUGLIFY:1537)
at org.mozilla.javascript.gen.JSUGLIFY_19.call(JSUGLIFY)

                ...... and more .....

This also happens if I try to package the simulation.

If I start to remove items from the drawingPanel then the problem mysteriously goes away.

Attached File: ConvergingLensVirtualImage.zip



OSP Projects:
Open Source Physics - EJS Modeling
Tracker
Physlet Physics
Physlet Quantum Physics
STP Book