alice-teacher Program crashes w/ index OOB exception?

Roger Wistar rwistar at hotchkiss.org
Tue Nov 16 07:59:56 EST 2010


One of my students¹ programs is crashing for a very strange reason I can¹t
identify. The student is using a list of objects and processing them with a
³For all XXX, every YYY together² block and using an if/else statement
inside the block to decide what to make the object do. For some reason, when
the else block is selected, the program crashes with the following error.
There are exactly three items in the list, so I don¹t know why index #2
would be OOB. I¹ve attached the A2W file and an HTML version of the source
code.

Please help me figure out what is wrong!

Roger Wistar
The Hotchkiss School

Error during simulation.


Alice version: 2.2  05/01/2010

Throwable that caused the error:
java.lang.ArrayIndexOutOfBoundsException: 2
    at 
edu.cmu.cs.stage3.alice.core.response.DoInOrder$RuntimeDoInOrder.childProlog
ueIfNecessary(DoInOrder.java:52)
    at 
edu.cmu.cs.stage3.alice.core.response.DoInOrder$RuntimeDoInOrder.update(DoIn
Order.java:100)
    at 
edu.cmu.cs.stage3.alice.core.response.DoInOrder$RuntimeDoInOrder.childUpdate
(DoInOrder.java:58)
    at 
edu.cmu.cs.stage3.alice.core.response.ForEachTogether$RuntimeForEachTogether
.childUpdate(ForEachTogether.java:74)
    at 
edu.cmu.cs.stage3.alice.core.response.DoInOrder$RuntimeDoInOrder.update(DoIn
Order.java:101)
    at 
edu.cmu.cs.stage3.alice.core.response.DoTogether$RuntimeDoTogether.update(Do
Together.java:71)
    at 
edu.cmu.cs.stage3.alice.core.response.DoInOrder$RuntimeDoInOrder.childUpdate
(DoInOrder.java:58)
    at 
edu.cmu.cs.stage3.alice.core.response.DoInOrder$RuntimeDoInOrder.update(DoIn
Order.java:101)
    at 
edu.cmu.cs.stage3.alice.core.response.DoInOrder$RuntimeDoInOrder.childUpdate
(DoInOrder.java:58)
    at 
edu.cmu.cs.stage3.alice.core.response.DoInOrder$RuntimeDoInOrder.update(DoIn
Order.java:101)
    at 
edu.cmu.cs.stage3.alice.core.response.CallToUserDefinedResponse$RuntimeCallT
oUserDefinedResponse.update(CallToUserDefinedResponse.java:89)
    at 
edu.cmu.cs.stage3.alice.core.behavior.TriggerBehavior.internalSchedule(Trigg
erBehavior.java:70)
    at edu.cmu.cs.stage3.alice.core.Behavior.schedule(Behavior.java:233)
    at 
edu.cmu.cs.stage3.alice.core.Sandbox.scheduleBehaviors(Sandbox.java:70)
    at edu.cmu.cs.stage3.alice.core.World.scheduleBehaviors(World.java:457)
    at edu.cmu.cs.stage3.alice.core.World.schedule(World.java:499)
    at 
edu.cmu.cs.stage3.alice.core.clock.DefaultClock.schedule(DefaultClock.java:9
9)
    at 
edu.cmu.cs.stage3.alice.authoringtool.AuthoringTool$7.run(AuthoringTool.java
:692)
    at 
edu.cmu.cs.stage3.alice.authoringtool.util.DefaultScheduler.simulateOnce(Def
aultScheduler.java:115)
    at 
edu.cmu.cs.stage3.alice.authoringtool.util.DefaultScheduler.run(DefaultSched
uler.java:76)
    at 
edu.cmu.cs.stage3.scheduler.AbstractScheduler.run(AbstractScheduler.java:45)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:633)
    at 
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java
:296)
    at 
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:21
1)
    at 
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:20
5)
    at java.awt.Dialog$1.run(Dialog.java:1045)
    at java.awt.Dialog$3.run(Dialog.java:1097)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.Dialog.show(Dialog.java:1095)
    at java.awt.Component.show(Component.java:1563)
    at java.awt.Component.setVisible(Component.java:1515)
    at java.awt.Window.setVisible(Window.java:841)
    at java.awt.Dialog.setVisible(Dialog.java:985)
    at 
edu.cmu.cs.stage3.swing.DialogManager.showModalDialog(DialogManager.java:61)
    at 
edu.cmu.cs.stage3.swing.DialogManager.showDialog(DialogManager.java:131)
    at 
edu.cmu.cs.stage3.alice.authoringtool.AuthoringTool.play(AuthoringTool.java:
5145)
    at 
edu.cmu.cs.stage3.alice.authoringtool.Actions$16.actionPerformed(Actions.jav
a:176)
    at 
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
    at 
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
    at 
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:3
87)
    at 
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at 
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener
.java:236)
    at 
java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
    at java.awt.Component.processMouseEvent(Component.java:6348)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3255)
    at java.awt.Component.processEvent(Component.java:6113)
    at java.awt.Container.processEvent(Container.java:2085)
    at java.awt.Component.dispatchEventImpl(Component.java:4714)
    at java.awt.Container.dispatchEventImpl(Container.java:2143)
    at java.awt.Component.dispatchEvent(Component.java:4544)
    at 
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4618)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4282)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4212)
    at java.awt.Container.dispatchEventImpl(Container.java:2129)
    at java.awt.Window.dispatchEventImpl(Window.java:2475)
    at java.awt.Component.dispatchEvent(Component.java:4544)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:635)
    at 
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java
:296)
    at 
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:21
1)
    at 
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)




-------------- next part --------------
A non-text attachment was scrubbed...
Name: Lists.a2w
Type: application/octet-stream
Size: 982005 bytes
Desc: Lists.a2w
Url : https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20101116/062c3e1d/attachment-0002.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Lists.html
Type: application/octet-stream
Size: 7938 bytes
Desc: Lists.html
Url : https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20101116/062c3e1d/attachment-0003.obj 


More information about the alice-teachers mailing list