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

[JENKINS-69578] Java serialization error when saving Jenkins project containing S3 publisher plugin #222

Merged
merged 2 commits into from
Sep 14, 2022

Conversation

basil
Copy link
Member

@basil basil commented Sep 13, 2022

See JENKINS-69578. Resolves an issue running on Java 17, which can no longer serialize java.util.logging.Level objects due to the java.util.logging package not being accessible to XStream. I solved the issue by instead serializing the name of the level:

-      <consoleLogLevel>
-        <name>INFO</name>
-        <value>800</value>
-        <resourceBundleName>sun.util.logging.resources.logging</resourceBundleName>
-      </consoleLogLevel>
+      <consoleLogLevelString>INFO</consoleLogLevelString>

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 the transient 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

Copy link
Member

@alecharp alecharp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks.

@alecharp alecharp merged commit c75e103 into jenkinsci:master Sep 14, 2022
@alecharp alecharp added the bug label Sep 14, 2022
@basil basil deleted the JENKINS-69578 branch October 13, 2022 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants