MapTool 1.4.1.8 Adjust Grid Error Message

Developer discussion regarding MapTool 1.4

Moderators: dorpond, trevor, Azhrei

Forum rules
Posting now open to all registered forum users.
Post Reply
Glendwyr
Kobold
Posts: 13
Joined: Mon Apr 11, 2016 4:11 am

MapTool 1.4.1.8 Adjust Grid Error Message

Post by Glendwyr »

I'm using the 64-bit version of 1.4.1.8 and have just run into something weird: with my campaign loaded, if I use the Adjust Grid command -- and even if I close the window without doing anything -- I get a rather lengthy error message:
Spoiler
java.lang.ClassCastException: java.util.LinkedList cannot be cast to net.rptools.maptool.model.Token
at net.rptools.maptool.client.ui.htmlframe.HTMLFrameFactory$Listener.modelChanged(HTMLFrameFactory.java:154)
at net.rptools.maptool.model.BaseModel.fireModelChangeEvent(BaseModel.java:33)
at net.rptools.maptool.model.Zone.putTokens(Zone.java:1159)
at net.rptools.maptool.client.tool.GridTool$2.actionPerformed(GridTool.java:123)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at net.rptools.maptool.client.swing.MapToolEventQueue.dispatchEvent(MapToolEventQueue.java:36)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Although I get this error message, the grid does change.

Things I can say about the error message:
  • It only appears if there is a token on the token layer of the map. If I move all my tokens from the token layer to the background layer, there is no error message; if I move them back, there is.
  • It doesn't seem to be related to any specific tokens -- I can drag a new image onto the map and the error message shows up.
  • It doesn't matter whether the token is snapped to the grid or not, nor whether it is given a size or displayed at its native size. The error message is also independent of Fog of War and vision settings.
  • The behavior seems to be related in some way to my campaign file, since I do not see the error message if I don't load my campaign file. However, if I do load it and then create a new campaign, I get the same error message in the new campaign.
  • The campaign file causing the error message was originally created in 1.3bsomething and has been used in 1.4.1.8 without difficulty thus far. If I use a backup copy of the campaign file that was never imported into 1.4.1.8, I get the error message, but I do not get the error message with the same campaign file in 1.3b86. I do get the same error in 1.4.0.5.
Since the grid does get properly adjusted, this is an error message I can live with, but it's awfully strange!

Glendwyr
Kobold
Posts: 13
Joined: Mon Apr 11, 2016 4:11 am

Re: MapTool 1.4.1.8 Adjust Grid Error Message

Post by Glendwyr »

Further testing provides a minimal example:
  • Start with a completely new campaign file.
  • Put something on the token layer.
  • Adjust Grid: everything works.
  • Execute the following macro: [Dialog("Hello World"): {Hello World}]
  • Adjust Grid: the error message appears.
Using a frame instead of a dialog gives the same result. This seems like something so ubiquitous that I assume it's a known issue.

Phergus
Deity
Posts: 7132
Joined: Fri May 12, 2006 8:56 pm
Location: Middle of Nowhere, NM
Contact:

Re: MapTool 1.4.1.8 Adjust Grid Error Message

Post by Phergus »

I have never run into it nor have I heard of anyone else encountering it. But I wouldn't normally be opening or have open Dialogs/Frames while adjusting the grid. That's the first thing I do when load a map - assuming it is needed.

Phergus
Deity
Posts: 7132
Joined: Fri May 12, 2006 8:56 pm
Location: Middle of Nowhere, NM
Contact:

Re: MapTool 1.4.1.8 Adjust Grid Error Message

Post by Phergus »


User avatar
Azhrei
Site Admin
Posts: 12057
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: MapTool 1.4.1.8 Adjust Grid Error Message

Post by Azhrei »

Great bug report, Glendwyr! You clearly have some background in trying to isolate software glitches, given how you carefully tried a lot of different options when the problem first occurred. :)

It looks like an internal event was fired when the grid changed (so that aspects of MT could adjust to the change), yet the dialog panel didn't handle it properly. I'll look at the code later, but I'd guess that the dialog has a stale copy of some data related to the map or the grid and referencing that stale data is what caused the problem.

Again, that's some great sleuthing — thanks! And thanks to Phergus for filing the bug report. :)

Glendwyr
Kobold
Posts: 13
Joined: Mon Apr 11, 2016 4:11 am

Re: MapTool 1.4.1.8 Adjust Grid Error Message

Post by Glendwyr »

Thanks all!

About half of my job is scientific programming, and about 90% of that is tracking down my own bugs. I'd love to be able to help in Maptool development, but all my programming experience is Fortran (and maptool script) and so not too useful for... well, much anything, really!

One small but potentially relevant correction to Phergus' bug report -- I get the same error message even if I close the dialog before invoking adjust grid, which I should have said. If it's helpful, I'll note that it doesn't seem to depend on whether the dialog is created with temporary=1 or not.

Phergus
Deity
Posts: 7132
Joined: Fri May 12, 2006 8:56 pm
Location: Middle of Nowhere, NM
Contact:

Re: MapTool 1.4.1.8 Adjust Grid Error Message

Post by Phergus »

That does seem relevant. Feel free to go ahead and add that as a comment to the bug. :)

Post Reply

Return to “MapTool 1.4”