From 08ec59e2f104837efc152cba0d7cd21268c55e25 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Jan 2024 00:58:32 +0000 Subject: [PATCH 1/3] build(deps): bump org.jenkins-ci.plugins:plugin from 4.76 to 4.77 Bumps [org.jenkins-ci.plugins:plugin](https://github.com/jenkinsci/plugin-pom) from 4.76 to 4.77. - [Release notes](https://github.com/jenkinsci/plugin-pom/releases) - [Changelog](https://github.com/jenkinsci/plugin-pom/blob/master/CHANGELOG.md) - [Commits](https://github.com/jenkinsci/plugin-pom/compare/plugin-4.76...plugin-4.77) --- updated-dependencies: - dependency-name: org.jenkins-ci.plugins:plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4d9c798..a0716dd 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.jenkins-ci.plugins plugin - 4.76 + 4.77 From 4ff7d7dc365fb6908011dbc73125638b11f88a54 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 22 Jan 2024 11:47:08 +0100 Subject: [PATCH 2/3] IMConnectionProvider.java: suppress a seemingly irrelevant spotbugs warning (does not seem to apply to this situation) Signed-off-by: Jim Klimov --- src/main/java/hudson/plugins/im/IMConnectionProvider.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/hudson/plugins/im/IMConnectionProvider.java b/src/main/java/hudson/plugins/im/IMConnectionProvider.java index a058be1..4533cd9 100644 --- a/src/main/java/hudson/plugins/im/IMConnectionProvider.java +++ b/src/main/java/hudson/plugins/im/IMConnectionProvider.java @@ -1,5 +1,6 @@ package hudson.plugins.im; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import hudson.model.User; import hudson.plugins.im.tools.ExceptionHelper; import java.util.concurrent.Semaphore; @@ -113,6 +114,9 @@ private void tryReconnect() { // we need an additional level of indirection to the Authentication entity // to fix HUDSON-5978 and HUDSON-5233 + @SuppressFBWarnings( + value = "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", + justification = "IMConnectionProvider.descriptor is checked in wrapping getAuthenticationHolder()") public synchronized AuthenticationHolder getAuthenticationHolder() { if (descriptor == null || descriptor.getHudsonUserName() == null) { return null; From e804dfd68299573dfa31281a27d9028d5026f886 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 22 Jan 2024 12:39:09 +0100 Subject: [PATCH 3/3] IMConnectionProvider.java: getAuthenticationHolder(): duplicate the sanity-check to satisfy spotbugs Signed-off-by: Jim Klimov --- .../java/hudson/plugins/im/IMConnectionProvider.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/hudson/plugins/im/IMConnectionProvider.java b/src/main/java/hudson/plugins/im/IMConnectionProvider.java index 4533cd9..1be1934 100644 --- a/src/main/java/hudson/plugins/im/IMConnectionProvider.java +++ b/src/main/java/hudson/plugins/im/IMConnectionProvider.java @@ -114,9 +114,6 @@ private void tryReconnect() { // we need an additional level of indirection to the Authentication entity // to fix HUDSON-5978 and HUDSON-5233 - @SuppressFBWarnings( - value = "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", - justification = "IMConnectionProvider.descriptor is checked in wrapping getAuthenticationHolder()") public synchronized AuthenticationHolder getAuthenticationHolder() { if (descriptor == null || descriptor.getHudsonUserName() == null) { return null; @@ -129,6 +126,12 @@ public Authentication getAuthentication() { return authentication; } + // New spotbugs UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR + // just can't be quiesced, so duplicating the sanity-check here + if (descriptor == null || descriptor.getHudsonUserName() == null) { + return null; + } + User u = User.get(descriptor.getHudsonUserName()); return u.impersonate();