[JENKINS-69578] Java serialization error when saving Jenkins project containing S3 publisher plugin #222
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See JENKINS-69578. Resolves an issue running on Java 17, which can no longer serialize
java.util.logging.Level
objects due to thejava.util.logging
package not being accessible to XStream. I solved the issue by instead serializing the name of the level:This PR implements a
readResolve
method to allow old data to be converted to the new format (when running under Java 11 or Java 8 where this bug does not occur). I added thetransient
keyword to the old field name to prevent it from being serialized to disk once it has been read for migration purposes, as recommended in the documentation.To test this, I successfully created data using the old version of the plugin with Java 11 and verified that the new version of the plugin with the changes from this PR running on Java 11 could parse the old data and write it out in the new format. I also verified that the steps to reproduce described in the Jira ticket failed before this PR on Java 17 and passed after this PR on Java 17.
CC @rsandell @jtnord @alecharp as the last few people to work on this plugin