From 383cd1157ea697d6c46c216c0c274fcf99ec49ad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jan 2022 11:00:41 +0000 Subject: [PATCH 1/4] Bump plugin from 4.24 to 4.33 Bumps [plugin](https://github.com/jenkinsci/plugin-pom) from 4.24 to 4.33. - [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.24...plugin-4.33) --- 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 13e7a8e0..54b9362e 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ org.jenkins-ci.plugins plugin - 4.24 + 4.33 pipeline-utility-steps From c8e38303ccb7bdedf446c4dbd42800ddc0256636 Mon Sep 17 00:00:00 2001 From: rsandell Date: Fri, 21 Jan 2022 16:16:12 +0100 Subject: [PATCH 2/4] Fix upper bounds New bom and core dependency More JSR 305 fixes --- pom.xml | 24 +++---------------- .../utility/steps/fs/FileVerifyHashStep.java | 8 +++---- .../utility/steps/fs/PrependToFileStep.java | 4 ++-- 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index 54b9362e..77d5e56b 100644 --- a/pom.xml +++ b/pom.xml @@ -58,7 +58,7 @@ 2.11.1 -SNAPSHOT - 2.222.4 + 2.289.3 8 Max true @@ -136,16 +136,11 @@ io.jenkins.tools.bom - bom-2.222.x - 887.vae9c8ac09ff7 + bom-2.289.x + 1117.v62a_f6a_01de98 import pom - - org.apache.commons - commons-lang3 - 3.12.0 - @@ -170,17 +165,4 @@ - - - jdk11 - - - none - true - - - 11 - - - diff --git a/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/fs/FileVerifyHashStep.java b/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/fs/FileVerifyHashStep.java index b3fa7e35..f52ff2e1 100644 --- a/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/fs/FileVerifyHashStep.java +++ b/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/fs/FileVerifyHashStep.java @@ -1,5 +1,6 @@ package org.jenkinsci.plugins.pipeline.utility.steps.fs; +import edu.umd.cs.findbugs.annotations.NonNull; import hudson.AbortException; import hudson.FilePath; import hudson.model.Descriptor; @@ -12,7 +13,6 @@ import org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution; import org.kohsuke.stapler.QueryParameter; -import javax.annotation.Nonnull; import java.io.FileNotFoundException; import java.util.Collections; import java.util.Locale; @@ -23,7 +23,7 @@ public abstract class FileVerifyHashStep extends Step { private final String hash; private final String hashAlgorithm; - public FileVerifyHashStep(String file, String hash, @Nonnull String hashAlgorithm) throws Descriptor.FormException { + public FileVerifyHashStep(String file, String hash, @NonNull String hashAlgorithm) throws Descriptor.FormException { if (StringUtils.isBlank(file)) { throw new Descriptor.FormException("can't be blank", "file"); } @@ -72,7 +72,7 @@ public String getFunctionName() { } @Override - @Nonnull + @NonNull public String getDisplayName() { return "Verify the " + algorithm.toUpperCase(Locale.ENGLISH) + " of a given file"; } @@ -99,7 +99,7 @@ public static class ExecutionImpl extends SynchronousNonBlockingStepExecution Date: Fri, 21 Jan 2022 17:18:48 +0100 Subject: [PATCH 3/4] Restoring no javadoc on jdk11 Problems in Snakeyaml. --- pom.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pom.xml b/pom.xml index 77d5e56b..6243f443 100644 --- a/pom.xml +++ b/pom.xml @@ -165,4 +165,17 @@ + + + jdk11 + + + none + true + + + 11 + + + From 416cdaafadc1d483d0ac001facb24904b51bb4e9 Mon Sep 17 00:00:00 2001 From: rsandell Date: Fri, 21 Jan 2022 17:54:40 +0100 Subject: [PATCH 4/4] Fix spotbugs --- .../pipeline/utility/steps/fs/PrependToFileStep.java | 8 ++++++-- .../plugins/pipeline/utility/steps/fs/TouchStep.java | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/fs/PrependToFileStep.java b/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/fs/PrependToFileStep.java index 99161c2d..c6d8b61c 100644 --- a/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/fs/PrependToFileStep.java +++ b/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/fs/PrependToFileStep.java @@ -24,6 +24,7 @@ package org.jenkinsci.plugins.pipeline.utility.steps.fs; +import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.Set; @@ -146,9 +147,12 @@ protected FileWrapper run() throws Exception { final FilePath ws = this.getContext().get(FilePath.class); assert ws != null; final FilePath file = ws.child(this.step.getFile()); - if (!file.exists()) { - file.getParent().mkdirs(); + FilePath parent = file.getParent(); + if (!file.exists() && parent != null) { + parent.mkdirs(); file.touch(System.currentTimeMillis()); + } else if (parent == null) { + throw new IOException("No parent path for " + file.getRemote()); } final String content = this.step.getContent(); final String originalContent = file.readToString(); diff --git a/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/fs/TouchStep.java b/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/fs/TouchStep.java index c9893a81..e9a29a19 100644 --- a/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/fs/TouchStep.java +++ b/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/fs/TouchStep.java @@ -39,6 +39,7 @@ import org.kohsuke.stapler.DataBoundSetter; import org.kohsuke.stapler.QueryParameter; +import java.io.IOException; import java.util.Collections; import java.util.Set; @@ -143,7 +144,12 @@ protected FileWrapper run() throws Exception { assert ws != null; FilePath file = ws.child(step.getFile()); long timestamp = step.getTimestamp() != null ? step.getTimestamp() : System.currentTimeMillis(); - file.getParent().mkdirs(); + final FilePath parent = file.getParent(); + if (parent != null) { + parent.mkdirs(); + } else { + throw new IOException("No parent path for " + file.getRemote()); + } file.touch(timestamp); return new FileWrapper(file); }