-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: move from hessian to protobuf #3254
Comments
Messages to test:
|
Can no longer load existing campaigns into MapTool with current code. Attempting to run maptool/src/main/java/net/rptools/maptool/client/ServerCommandClientImpl.java Lines 648 to 650 in 60a2de6
|
I also ran into this. Lots of NullPointerExecptions when converting to DTO. There are a fair number of of object fields that aren't handled in Some of the problem fields do have default values but those fields are being overwritten when deserialized. I don't know yet if that's because the XML explicitly contains There was one weird situation I ran into:
I can include a fix for this as well. |
Sounds like you should go ahead and submit a PR. @thelsing thoughts? |
I did some research into null values vs xstream. Apparently xstream isn't setting these missing fields to null, it instead just skips object construction altogether. Not only does this mean no constructors are called, neither is the object initializer (that surprised me). As a result, all fields are set by Java to their defaults according to type (so The above describes the default "reflection provider". Xstream has other reflection providers with different behaviour. E.g., there is the |
I'm a bit confused how the null values got into the campaign file and how this is related to the protobuf change. The fromDto methods that I added for protobuf serialisation call the constuctors properly. We can add further initialisation there if needed. The long term plan was to move away from xstream and use protobuf DTOs converted to Json and store them instead of the xstream xml. Maybe even use some nonsql db to store them. |
I figured that's what had happened as no previously created campaigns would load. |
The |
Note to myself: test if some bigger campaigns can be opened without error. |
During testing of #3274 I discovered that the protobuf code can throw this exception for HeroLab tokens:
java.lang.NullPointerException
at net.rptools.maptool.server.proto.HeroLabDataDto$Builder.setMinionMasterIndex(HeroLabDataDto.java:1686)
at net.rptools.maptool.model.HeroLabData.toDto(HeroLabData.java:557)
at net.rptools.maptool.model.Token.toDto(Token.java:3011)
at net.rptools.maptool.client.ServerCommandClientImpl.putToken(ServerCommandClientImpl.java:174)
at net.rptools.maptool.client.ui.zone.ZoneRenderer.addTokens(ZoneRenderer.java:4636)
at net.rptools.maptool.client.ui.zone.ZoneRenderer.drop(ZoneRenderer.java:4705)
at java.desktop/javax.swing.TransferHandler$SwingDropTarget.drop(TransferHandler.java:1287)
at java.desktop/sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(SunDropTargetContextPeer.java:548)
at java.desktop/sun.awt.X11.XDropTargetContextPeer.processDropMessage(XDropTargetContextPeer.java:185)
at java.desktop/sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchDropEvent(SunDropTargetContextPeer.java:864)
at java.desktop/sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(SunDropTargetContextPeer.java:788)
at java.desktop/sun.awt.dnd.SunDropTargetEvent.dispatch(SunDropTargetEvent.java:48)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4866)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
at java.desktop/java.awt.LightweightDispatcher.processDropTargetEvent(Container.java:4649)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4511)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:746)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:743)
at net.rptools.maptool.client.swing.MapToolEventQueue.dispatchEvent(MapToolEventQueue.java:54)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
PR #3443 addresses that.
|
I ran into some NPEs when loading old campaigns related to this. I'll submit a PR. I also encountered a few campaigns that threw this when trying to load (originating from Path.java):
Edit: Decided to look into this exception a bit more and have something now. Turns out really old tokens can actually have a |
Any future issues with old campaigns can go on other issues. Closing for 1.12 release. |
Feature Request
To address security concerns of hessian serialisation and to allow easier interoperability with other tools like apps for initiative tracking or similar stuff it would be nice to move from hessian to protobuf.
A nice site effect is, that we would have a defined representation of the data. So we could store the protobuf objects on disk or in a DB an get rid of java serialisation as on disk format later.
The Solution you'd like
Remove everything hessian related and replace it with protobuf.
Alternatives that you've considered.
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: