Skip to content
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

Make XStream more agreeable, and other fixes #4067

Conversation

kwvanderlinde
Copy link
Collaborator

@kwvanderlinde kwvanderlinde commented May 15, 2023

Identify the Bug or Feature request

Fixes #4066

Description of the Change

The enum ShapeType is now considered referencable by XStream. This allows it to load campaigns that contain references to a ShapeType while still not writing them out anymore. The same was done to BarTokenOverlay.Side to load other campaigns.

On the way, a few other problems were found and fixed:

  • Error dialogs weren't keeping newlines, making XStream messages very wide.
  • MacroButtonProperties.saveLocation was forgotten in readResolve() in Make almost all of MacroButtonProperties fields non-null #4052, causing some NPEs
  • LineSegment.width was nullable, and toDto() was not accounting for that. It is no longer nullable, as readResolve() handles it.

Possible Drawbacks

Higher memory usage according to the XStream docs.

Documentation Notes

N/A

Release Notes

  • Improved backwards compatibility with campaigns from the 1.13b50 era, allowing more of them to be loaded.

This change is Reviewable

With the move to Java 20, JOptionPane is no longer respecting our newlines. So we have to replace them with `<br/>`
instead.
The two enum types known to be referenced are:
- `net.rptools.maptool.model.ShapeType`
- `net.rptools.maptool.client.ui.token.BarTokenOverlay.Side`

Some old campaigns still have references to these, and by adding them they can be opened once again.
This field was missed in the `readResolve()` method.
Old campaigns could deserialize with the `width` field being null. This is now handled via `readResolve()` rather than
being leaving it up to later interactions to provide a value.
@cwisniew cwisniew added this pull request to the merge queue May 16, 2023
Merged via the queue into RPTools:develop with commit e288212 May 16, 2023
4 checks passed
@kwvanderlinde kwvanderlinde deleted the bugfix/4066-old-xstream-artifacts-giving-us-trouble branch May 16, 2023 16:41
@cwisniew cwisniew added the code-maintenance Adding/editing javadocs, unit tests, formatting. label May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-maintenance Adding/editing javadocs, unit tests, formatting.
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

[Bug]: Unable to load certain old campaigns
2 participants