-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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 DM_DEFAULT_ENCODING
SpotBugs violations
#6050
Conversation
@@ -668,7 +669,7 @@ public void defaultCheckout() throws IOException, InterruptedException { | |||
} | |||
} catch (AbortException e) { | |||
listener.error(e.getMessage()); | |||
} catch (InterruptedIOException e) { | |||
} catch (ClosedByInterruptException | InterruptedIOException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change to SCM.java
elsewhere in this PR (from traditional Java I/O to NIO.2) means that cancelling a job while SCM checkout is taking place can now throw ClosedByInterruptException
as well as InterruptedException
and InterruptedIOException
. Higher-level code marks the build as ABORTED
for InterruptedException
and FAILURE
for other I/O exceptions, so we convert the ClosedByInterruptException
to an InterruptedException
here (just as the existing code does for InterruptedIOException
) so that the build will be shown as ABORTED
(as with the pre-NIO.2 logic).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All changes look reasonable. PEMs files should always be UTF-8, same as Unix process files IIRC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least one spotbugs warning was masking a real issue.
I have looked at the other ones and can not say for certain that all of them are correct but they appear to be. Given this change would then mask the reports of potential issues it may be better to have a few more eyes on this than normal.
To be clear - this change does not introduce any bug - but as the spotbugs warnings are fixed, there is no longer a report to look into something.
Co-authored-by: James Nord <[email protected]>
Co-authored-by: James Nord <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can not say for certain that the changes are all that all correct but they appear to be. Given this change would then mask the reports of potential issues it may be better to have a few more eyes on this than normal.
To be clear - this change does not introduce any bug - but as the spotbugs warnings are fixed, there is no longer a report to look into something.
Any other takers? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A number of places here where default charset is specified but I think UTF-8 would be more correct. I understand that you are actually making the more conservative change here—retaining existing behavior—but by making the warning go away and adding an explicit call to defaultCharset
it makes it look like this was intentional, when generally it was not, thus making it less likely that the code would be corrected in the future compared to just leaving it alone (or adding a suppression annotation).
core/src/main/java/hudson/security/csrf/DefaultCrumbIssuer.java
Outdated
Show resolved
Hide resolved
core/src/main/java/jenkins/security/DefaultConfidentialStore.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I think.
Thanks. I'll run this through BOM testing before merging for good measure. |
Would not hurt, though I doubt PCT would catch interesting regressions here since all the CI machines should be using UTF-8 system encoding anyway. |
But re-running the tests after I merge the Windows CI PR should cover that. |
Yes that should help. I suspect any actual regressions would be in unusual user configurations not covered by tests. |
This PR is now ready for merge. We will merge it after approximately 24 hours if there is no negative feedback. Please see the merge process documentation for more information about the merge process. Thanks! |
OTOH as of https://openjdk.org/jeps/400 it should not matter typically, so choice of |
Fix
DM_DEFAULT_ENCODING
SpotBugs violations by explicitly passing in the default character set where possible (orStandardCharsets.UTF_8
for Unix-specific functionality).Proposed changelog entries
N/A
Proposed upgrade guidelines
N/A
Submitter checklist
Proposed changelog entries
section only if there are breaking changes or other changes which may require extra steps from users during the upgradeDesired reviewers
@mention
Maintainer checklist
Before the changes are marked as
ready-for-merge
:Proposed changelog entries
are correctupgrade-guide-needed
label is set and there is aProposed upgrade guidelines
section in the PR title. (example)lts-candidate
to be considered (see query).