December 2016


Options: Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
1.0 (Mac OS X Mail 9.3 \(3124\))
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Marshall <[log in to unmask]>
Fri, 30 Dec 2016 22:15:16 -0600
multipart/alternative; boundary="Apple-Mail=_9DA703EB-E9F5-49A9-8E2E-CC0BF9310DDC"
MASON Multiagent Simulation Toolkit <[log in to unmask]>
text/plain (5 kB) , text/html (12 kB)
I encountered an issue with HexaObjectGridPortrayal2D using this week’s MASON commit.  Here
is a Java example using both setPortrayalForNull and setPortrayalForClass on a grid field in which not every cell is filled.

(Sean, should I just send this kind of bug report directly to you, or is it best to send it to the mailing list?)

1. If I use HexaObjectGridPortrayal2D and double-click on one of the OvalPortrayal2D’s on a null cell, I get an NPE (but the program doesn’t die).  Double-clicking on the portrayal of a cell with an Object produces the normal inspector behavior.  Double-clicking on an unfilled region of the display does nothing (no NPE).  If I switch to using an ObjectGridPortrayal2D, double-clicking on the portrayal of a null cell does nothing—no NPE—and the other behaviors are the same as before.  So the NPE only occurs with HexaObjectGridPortrayal2D.  This occurs with the new version that Sean committed this week, but not with the MASON 19 distribution jar (which doesn’t allow CircledPortrayal2D to work fully with HexaObjectGridPortrayal2D).

This is not such a bad thing in itself: An NPE that doesn’t stop the app, that only happens when the user does something s/he has no need to do.  However, the reason I found this problem is that I was trying to produce a simple Java example that would reproduce a problem in my Clojure model.  I haven’t succeeded in reproducing problem exactly, but the Clojure problem and the problem exhibited by the Java example described above have exactly the same stack traces—line numbers, everything—so it seems plausible that they’re related.

2. The problem in the Clojure model is that double-clicking on the portrayals of one of my agents (OvalPortrayal2D or RectanglePortrayal2D) produces the usual inspector behavior if I use an ObjectGridPortrayal2Ds, but if I use HexaObjectGridPortrayal2Ds, I get the NPE and stack trace but no inspector.  Again, this occurs with the new commit but not with the distribution version of MASON.

[I don’t think anyone on the list will want to run the Clojure model, but if so, it’s here:  To run it you need Leiningen (, which will install Clojure and all libs that you need except for the usual libs that MASON uses.  I put links to those in lib/ under the root of the repo.  There are run scripts in src/scripts.]



The stack trace:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at sim.util.SimpleProperties.numProperties(
	at sim.portrayal.SimpleInspector.generateProperties(
	at sim.portrayal.SimpleInspector.<init>(
	at sim.portrayal.SimpleInspector.<init>(
	at sim.portrayal.SimpleInspector.<init>(
	at sim.portrayal.Inspector.getInspector(
	at sim.portrayal.SimplePortrayal2D.getInspector(
	at sim.portrayal.FieldPortrayal.getInspector(
	at sim.display.Display2D.createInspectors(
	at sim.display.Display2D.createInspectors(
	at sim.display.Display2D$8.mouseClicked(
	at java.awt.AWTEventMulticaster.mouseClicked(
	at java.awt.Component.processMouseEvent(
	at javax.swing.JComponent.processMouseEvent(
	at java.awt.Component.processEvent(
	at java.awt.Container.processEvent(
	at java.awt.Component.dispatchEventImpl(
	at java.awt.Container.dispatchEventImpl(
	at java.awt.Component.dispatchEvent(
	at java.awt.LightweightDispatcher.retargetMouseEvent(
	at java.awt.LightweightDispatcher.processMouseEvent(
	at java.awt.LightweightDispatcher.dispatchEvent(
	at java.awt.Container.dispatchEventImpl(
	at java.awt.Window.dispatchEventImpl(
	at java.awt.Component.dispatchEvent(
	at java.awt.EventQueue.dispatchEventImpl(
	at java.awt.EventQueue.access$500(
	at java.awt.EventQueue$
	at java.awt.EventQueue$
	at Method)
	at java.awt.EventQueue$
	at java.awt.EventQueue$
	at Method)
	at java.awt.EventQueue.dispatchEvent(
	at java.awt.EventDispatchThread.pumpOneEventForFilters(
	at java.awt.EventDispatchThread.pumpEventsForFilter(
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(
	at java.awt.EventDispatchThread.pumpEvents(
	at java.awt.EventDispatchThread.pumpEvents(