alice-teacher world in Aug Alice gets null pointer exception running in Dec Alice

Don Slater dslater at andrew.cmu.edu
Tue Jan 24 20:14:17 EST 2012


The problem is in the world.checkClose function, and it seems to be a problem with Alice, not your students programming.

He is setting the variable "distTo" with the expression 

	"whatObject" (parameter) distance To "juggler.upperbody.forearm.hand"

It turns out that if you rewrite the expression

	"distTo" set value to "juggler.upperbody.forearm.hand" distance to "whatObject"

The program executes correctly, and I might add, very nicely. I have attached a corrected version.

As a note to your student, I identified the problem by disabling all the code statements, and then slowly enabling them one by one until the error appeared. Now it turns out that you cannot disable statements in Alice functions, which I am not sure I understand, and so I changed the values of the different statements until the error appeared again.

We have had some experience that the "distance to" function does not work well with a parameter as the subject, but that it works well as the object of the statement. In other words, Alice knows how to find the distance from the hand to the parameter, because as it executes it is able to identify the hand as an object it knows about in the world, which exists before runtime, but the parameter is not really identified until runtime.

This is probably way more information than you need, but I am sort of thinking out loud about this, to perhaps spark some other thoughts and insights.

Let me know if you have any other questions.

All the best,
Don Slater


-------------- next part --------------
A non-text attachment was scrubbed...
Name: jugglingManV2.a2w
Type: application/octet-stream
Size: 672294 bytes
Desc: not available
Url : https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20120124/b9d419f8/attachment-0001.obj 
-------------- next part --------------

On Jan 24, 2012, at 4:52 PM, Rikki Fletcher wrote:

> Attached is a world that crashes after the first ball gets thrown up.
> Not all worlds crash - but it happens with more than just this one.  Any
> ideas?
> Thanks.
> 
> "Error during simulation"
> 
> Error during simulation.
> 
> 
> 
> 
> Alice version: 2.2  12/01/2011
> 
> 
> 
> Throwable that caused the error:
> 
> java.lang.NullPointerException
> 
> 	at
> edu.cmu.cs.stage3.alice.core.question.DistanceTo.getValue(DistanceTo.java:35)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.question.SubjectObjectQuestion.getValue(SubjectObjectQuestion.java:103)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.question.SubjectQuestion.getValue(SubjectQuestion.java:36)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.Property.evaluateIfNecessary(Property.java:380)
> 
> 	at edu.cmu.cs.stage3.alice.core.Property.getValue(Property.java:407)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.question.userdefined.PropertyAssignment.execute(PropertyAssignment.java:73)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.question.userdefined.UserDefinedQuestion.getValue(UserDefinedQuestion.java:56)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.question.userdefined.CallToUserDefinedQuestion.getValue(CallToUserDefinedQuestion.java:62)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.Property.evaluateIfNecessary(Property.java:380)
> 
> 	at edu.cmu.cs.stage3.alice.core.Property.getValue(Property.java:407)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.property.BooleanProperty.getValue(BooleanProperty.java:34)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.property.BooleanProperty.getBooleanValue(BooleanProperty.java:46)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.property.BooleanProperty.booleanValue(BooleanProperty.java:49)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.property.BooleanProperty.booleanValue(BooleanProperty.java:57)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.response.IfElseInOrder$RuntimeIfElseInOrder.prologue(IfElseInOrder.java:54)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.response.DoInOrder$RuntimeDoInOrder.childPrologueIfNecessary(DoInOrder.java:53)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.response.DoInOrder$RuntimeDoInOrder.update(DoInOrder.java:100)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.response.CallToUserDefinedResponse$RuntimeCallToUserDefinedResponse.update(CallToUserDefinedResponse.java:89)
> 
> 	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(DoInOrder.java:101)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.response.DoTogether$RuntimeDoTogether.update(DoTogether.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(DoInOrder.java:101)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.response.CallToUserDefinedResponse$RuntimeCallToUserDefinedResponse.update(CallToUserDefinedResponse.java:89)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.response.DoTogether$RuntimeDoTogether.update(DoTogether.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(DoInOrder.java:101)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.response.CallToUserDefinedResponse$RuntimeCallToUserDefinedResponse.update(CallToUserDefinedResponse.java:89)
> 
> 	at
> edu.cmu.cs.stage3.alice.core.behavior.TriggerBehavior.internalSchedule(TriggerBehavior.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:99)
> 
> 	at
> edu.cmu.cs.stage3.alice.authoringtool.AuthoringTool$7.run(AuthoringTool.java:693)
> 
> 	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:209)
> 
> 	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:641)
> 
> 	at java.awt.EventQueue.access$000(EventQueue.java:84)
> 
> 	at java.awt.EventQueue$1.run(EventQueue.java:602)
> 
> 	at java.awt.EventQueue$1.run(EventQueue.java:600)
> 
> 	at java.security.AccessController.doPrivileged(Native Method)
> 
> 	at
> java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
> 
> 	at java.awt.EventQueue.dispatchEvent(EventQueue.java:611)
> 
> 	at
> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
> 
> 	at
> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
> 
> 	at
> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
> 
> 	at java.awt.Dialog$1.run(Dialog.java:1046)
> 
> 	at java.awt.Dialog$3.run(Dialog.java:1098)
> 
> 	at java.security.AccessController.doPrivileged(Native Method)
> 
> 	at java.awt.Dialog.show(Dialog.java:1096)
> 
> 	at java.awt.Component.show(Component.java:1584)
> 
> 	at java.awt.Component.setVisible(Component.java:1536)
> 
> 	at java.awt.Window.setVisible(Window.java:842)
> 
> 	at java.awt.Dialog.setVisible(Dialog.java:986)
> 
> 	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:5229)
> 
> 	at
> edu.cmu.cs.stage3.alice.authoringtool.Actions$16.actionPerformed(Actions.java:177)
> 
> 	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
> 
> 	at
> javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
> 
> 	at
> javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
> 
> 	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:6288)
> 
> 	at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
> 
> 	at java.awt.Component.processEvent(Component.java:6053)
> 
> 	at java.awt.Container.processEvent(Container.java:2041)
> 
> 	at java.awt.Component.dispatchEventImpl(Component.java:4651)
> 
> 	at java.awt.Container.dispatchEventImpl(Container.java:2099)
> 
> 	at java.awt.Component.dispatchEvent(Component.java:4481)
> 
> 	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
> 
> 	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
> 
> 	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
> 
> 	at java.awt.Container.dispatchEventImpl(Container.java:2085)
> 
> 	at java.awt.Window.dispatchEventImpl(Window.java:2478)
> 
> 	at java.awt.Component.dispatchEvent(Component.java:4481)
> 
> 	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643)
> 
> 	at java.awt.EventQueue.access$000(EventQueue.java:84)
> 
> 	at java.awt.EventQueue$1.run(EventQueue.java:602)
> 
> 	at java.awt.EventQueue$1.run(EventQueue.java:600)
> 
> 	at java.security.AccessController.doPrivileged(Native Method)
> 
> 	at
> java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
> 
> 	at
> java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
> 
> 	at java.awt.EventQueue$2.run(EventQueue.java:616)
> 
> 	at java.awt.EventQueue$2.run(EventQueue.java:614)
> 
> 	at java.security.AccessController.doPrivileged(Native Method)
> 
> 	at
> java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
> 
> 	at java.awt.EventQueue.dispatchEvent(EventQueue.java:613)
> 
> 	at
> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
> 
> 	at
> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
> 
> 	at
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
> 
> 	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
> 
> 	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
> 
> 	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
> 
> 
> 
> <jugglingMan.a2w>_______________________________________________
> alice-teachers mailing list
> alice-teachers at lists.andrew.cmu.edu
> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers



More information about the alice-teachers mailing list