-
Notifications
You must be signed in to change notification settings - Fork 323
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
Fix spotbugs errors #794
Merged
Merged
Fix spotbugs errors #794
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixed spotbugs error: Removed Clonable declaration from classes that didn't use it and/or didn't implement it.
pjdarton
added
the
WIP
PR that is *not* ready for merging (but hopefully being worked on by the author).
label
Apr 24, 2020
Bugfix: Removed Serializable declaration from classes that contain non-serializable fields. Added serialVersionUID to classes that need it. Removed serialVersionUID from classes that didn't need it. Fixed spotbugs error: transient field not set by deserialization Bugfix: DockerNodeStep's connector has to be Serializable.
Renamed properties in Messages.properties to fit with naming conventions. Local variables shouldn't start with a capital letter.
We use UTF-8 unless we're sure US-ASCII will suffice.
Enhancement: Where possible, store nulls instead of empty strings/collections. Code improvement: Added @CheckForNull/@Nullable/@Nonnull/@deprecated annotations to aid clarity. Refactor: Moved String split/filter/trim methods to JenkinsUtils class. Null-proofed code.
Unified the two methods of parsing a volumes string within DockerTemplateBase to one common method used for both processing and validation.
DockerComputerAttachConnector text hard-coded name of java and the jvm args. Now the help reads these from the code so they can't get out of step.
Found by spotbugs error: DockerBuilderControlOptionStop didn't remove containers when it was told to - it didn't exec the removal.
- Added @restricted(NoExternalUse.class) to code that shouldn't be used outside the plugin. - Made some classes/methods static where possible. - Made some things less visible where possible.
Fixed some potential null-pointer exceptions. Removed redundant null checks.
Removed unnecessary code. Remove unnecessary cast. Fix inefficient use of boxing.
Sometimes spotbugs gets it wrong. Sometimes spotbugs is right but it isn't a problem in practise and it's not worthwhile trying to fix it.
Eclipse complains about an unnecessary cast and wants it gone. My local build doesn't complain either way. JenkinsCI fails to compile without the cast.
Make sure subsequent builds insist on a clean result.
pjdarton
added
bug
An issue reporting a bug or a PR fixing one.
build
Changes unrelated to functionality, e.g. build code.
and removed
WIP
PR that is *not* ready for merging (but hopefully being worked on by the author).
labels
Apr 25, 2020
This was referenced Apr 27, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This plugin's pom says not to fail if spotbugs finds problems; that's not good.
This PR fixes those issues through a series of commits.
FAO anyone merging these changes:
I've tried to keep the commits fairly self-contained, with each one addressing one thing or one theme at a time but there were mistakes made during the commital phase where e.g. code changes went into an earlier commit than the imports it depended on.
The unit tests only passed on the final build, but that's mainly because DockerNodeStepTest is unstable on the jenkinsci build server (but works fine locally). Code was added (in the last commit) to attempt to address that, but it's still not stable.
A summary of the functional changes is as follows: