Alice Community  

Go Back   Alice Community > Alice 2 > Bugs and Troubleshooting

Reply
 
Thread Tools Display Modes
Array Index Out of Bounds Exception
Old
depasqua
Guest
 
Status:
Posts: n/a
Question Array Index Out of Bounds Exception - 06-22-2007, 08:57 AM

I have a simple world (which is attached to this message) . Each time I click on the handle of the toggle, the world crashes. I think the problem lies in the 'Do Together' in the code that animates the carousel's horses. This is code that is similar to the carousel methods provided as delivered by Alice.

I'm wondering if anyone can download the world, confirm the crash and help me understand what I'm doing that is causing this. Thanks!

The full error message is:
Code:
Error during simulation.


Alice version: 2.0.7
os.name: Mac OS X
os.version: 10.4.10
os.arch: i386
java.vm.name: Java HotSpot(TM) Client VM
java.vm.version: 1.4.2-76
user.dir: /Applications/Alice.app/Contents/Required

Throwable that caused the error:
java.lang.ArrayIndexOutOfBoundsException: -1 not in range [0,2)
	at edu.cmu.cs.stage3.alice.core.Behavior$Fork.getNext(Behavior.java:113)
	at edu.cmu.cs.stage3.alice.core.Behavior$RuntimeStack.top(Behavior.java:55)
	at edu.cmu.cs.stage3.alice.core.Behavior.stackLookup(Behavior.java:269)
	at edu.cmu.cs.stage3.alice.core.Property.evaluateIfNecessary(Property.java:367)
	at edu.cmu.cs.stage3.alice.core.Property.getValue(Property.java:407)
	at edu.cmu.cs.stage3.alice.core.property.BooleanProperty.getValue(BooleanProperty.java:33)
	at edu.cmu.cs.stage3.alice.core.property.BooleanProperty.getBooleanValue(BooleanProperty.java:45)
	at edu.cmu.cs.stage3.alice.core.property.BooleanProperty.booleanValue(BooleanProperty.java:48)
	at edu.cmu.cs.stage3.alice.core.behavior.ConditionalBehavior.preSchedule(ConditionalBehavior.java:36)
	at edu.cmu.cs.stage3.alice.core.Sandbox.scheduleBehaviors(Sandbox.java:69)
	at edu.cmu.cs.stage3.alice.core.World.scheduleBehaviors(World.java:444)
	at edu.cmu.cs.stage3.alice.core.World.schedule(World.java:486)
	at edu.cmu.cs.stage3.alice.core.clock.DefaultClock.schedule(DefaultClock.java:94)
	at edu.cmu.cs.stage3.alice.authoringtool.AuthoringTool$11.run(AuthoringTool.java:689)
	at edu.cmu.cs.stage3.alice.authoringtool.util.DefaultScheduler.simulateOnce(DefaultScheduler.java:115)
	at edu.cmu.cs.stage3.alice.authoringtool.util.DefaultScheduler.run(DefaultScheduler.java:76)
	at edu.cmu.cs.stage3.scheduler.AbstractScheduler.run(AbstractScheduler.java:45)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:189)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:478)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.Dialog$1.run(Dialog.java:542)
	at java.awt.Dialog$3.run(Dialog.java:569)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.awt.Dialog.show(Dialog.java:567)
	at java.awt.Component.show(Component.java:1133)
	at java.awt.Component.setVisible(Component.java:1088)
	at edu.cmu.cs.stage3.swing.DialogManager.showModalDialog(DialogManager.java:58)
	at edu.cmu.cs.stage3.swing.DialogManager.showDialog(DialogManager.java:123)
	at edu.cmu.cs.stage3.alice.authoringtool.AuthoringTool.play(AuthoringTool.java:5087)
	at edu.cmu.cs.stage3.alice.authoringtool.Actions$15.actionPerformed(Actions.java:167)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1819)
	at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1872)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:247)
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
	at java.awt.Component.processMouseEvent(Component.java:5166)
	at java.awt.Component.processEvent(Component.java:4963)
	at java.awt.Container.processEvent(Container.java:1613)
	at java.awt.Component.dispatchEventImpl(Component.java:3681)
	at java.awt.Container.dispatchEventImpl(Container.java:1671)
	at java.awt.Component.dispatchEvent(Component.java:3543)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3527)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3242)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3172)
	at java.awt.Container.dispatchEventImpl(Container.java:1657)
	at java.awt.Window.dispatchEventImpl(Window.java:1606)
	at java.awt.Component.dispatchEvent(Component.java:3543)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:480)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:170)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Attached Files
File Type: a2w Carousel Switch.a2w (800.9 KB, 471 views)
   
Reply With Quote
Old
DrJim
Guest
 
Status:
Posts: n/a
Default 06-22-2007, 11:30 AM

The problem is flipping the lever, not the horse animation. That runs fine when you run that method by itself.

Attached is a version that works - I just elimated the "event while" and did the same thing with a world level method. This is a fairly unsatisfactory answer since I can see no real reason the original didn't work - and especially don't see why it would generate the error message it did. I only tried this because I'm suspicious of "event whiles" in general. (One problem with the original may have been the scope of the "flipped" variable as local to a method, however moving it to a world level variable didn't fix the problem.)
Attached Files
File Type: a2w carouse_lWW&V.a2w (808.9 KB, 452 views)
   
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.