From 7a4cd6bb27480405fae3c82207addfcaea9acc29 Mon Sep 17 00:00:00 2001 From: Michael DK Fowler Date: Thu, 19 Jan 2017 12:57:02 -0500 Subject: [PATCH] Fixed some minor build warnings --- pom.xml | 2 +- .../java/hudson/plugins/msbuild/MSBuildErrorNote.java | 1 + .../java/hudson/plugins/msbuild/MSBuildWarningNote.java | 1 + src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java | 9 +++++---- .../java/hudson/plugins/msbuild/MsBuildInstallation.java | 5 ++++- .../hudson/plugins/msbuild/MsBuildKillingVetoTest.java | 1 + 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 3ab0eef..b93726a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.jenkins-ci.plugins plugin - 2.6 + 2.20 msbuild diff --git a/src/main/java/hudson/plugins/msbuild/MSBuildErrorNote.java b/src/main/java/hudson/plugins/msbuild/MSBuildErrorNote.java index 3a9e8f1..a75ae43 100644 --- a/src/main/java/hudson/plugins/msbuild/MSBuildErrorNote.java +++ b/src/main/java/hudson/plugins/msbuild/MSBuildErrorNote.java @@ -28,6 +28,7 @@ public ConsoleAnnotator annotate(Object context, MarkupText text, int charPos) { @Extension @Symbol("msbuildError") public static final class DescriptorImpl extends ConsoleAnnotationDescriptor { + @Override public String getDisplayName() { return Messages.MsBuildBuilder_ErrorNoteDescription(); } diff --git a/src/main/java/hudson/plugins/msbuild/MSBuildWarningNote.java b/src/main/java/hudson/plugins/msbuild/MSBuildWarningNote.java index 3d16a88..db066ba 100644 --- a/src/main/java/hudson/plugins/msbuild/MSBuildWarningNote.java +++ b/src/main/java/hudson/plugins/msbuild/MSBuildWarningNote.java @@ -28,6 +28,7 @@ public ConsoleAnnotator annotate(Object context, MarkupText text, int charPos) { @Extension @Symbol("msbuildWarning") public static final class DescriptorImpl extends ConsoleAnnotationDescriptor { + @Override public String getDisplayName() { return Messages.MsBuildBuilder_WarningNoteDescription(); } diff --git a/src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java b/src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java index c15f20e..140ba32 100644 --- a/src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java +++ b/src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java @@ -161,7 +161,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListen //Build /P:key1=value1;key2=value2 ... Map propertiesVariables = getPropertiesVariables(build); - if (buildVariablesAsProperties && propertiesVariables.size() != 0) { + if (buildVariablesAsProperties && !propertiesVariables.isEmpty()) { StringBuffer parameters = new StringBuffer(); parameters.append("/p:"); for (Map.Entry entry : propertiesVariables.entrySet()) { @@ -178,7 +178,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListen normalizedFile = msBuildFile.replaceAll("[\t\r\n]+", " "); normalizedFile = Util.replaceMacro(normalizedFile, env); normalizedFile = Util.replaceMacro(normalizedFile, build.getBuildVariables()); - if (normalizedFile.length() > 0) { + if (!normalizedFile.isEmpty()) { args.add(normalizedFile); } } @@ -223,7 +223,7 @@ private Map getPropertiesVariables(AbstractBuild build) { Map buildVariables = build.getBuildVariables(); final Set sensitiveBuildVariables = build.getSensitiveBuildVariables(); - if (sensitiveBuildVariables == null || sensitiveBuildVariables.size() == 0) { + if (sensitiveBuildVariables == null || sensitiveBuildVariables.isEmpty()) { return buildVariables; } @@ -258,7 +258,7 @@ static String getToolFullPath(Launcher launcher, String pathToTool, String execN @Override public Descriptor getDescriptor() { - return (DescriptorImpl) super.getDescriptor(); + return super.getDescriptor(); } /** @@ -292,6 +292,7 @@ public DescriptorImpl() { load(); } + @Override public String getDisplayName() { return Messages.MsBuildBuilder_DisplayName(); } diff --git a/src/main/java/hudson/plugins/msbuild/MsBuildInstallation.java b/src/main/java/hudson/plugins/msbuild/MsBuildInstallation.java index 2a5b937..841d7ab 100644 --- a/src/main/java/hudson/plugins/msbuild/MsBuildInstallation.java +++ b/src/main/java/hudson/plugins/msbuild/MsBuildInstallation.java @@ -43,7 +43,7 @@ */ public final class MsBuildInstallation extends ToolInstallation implements NodeSpecific, EnvironmentSpecific { - private String defaultArgs; + private final String defaultArgs; @DataBoundConstructor public MsBuildInstallation(String name, String home, String defaultArgs) { @@ -51,10 +51,12 @@ public MsBuildInstallation(String name, String home, String defaultArgs) { this.defaultArgs = Util.fixEmpty(defaultArgs); } + @Override public MsBuildInstallation forNode(Node node, TaskListener log) throws IOException, InterruptedException { return new MsBuildInstallation(getName(), translateFor(node, log), getDefaultArgs()); } + @Override public MsBuildInstallation forEnvironment(EnvVars environment) { return new MsBuildInstallation(getName(), environment.expand(getHome()), getDefaultArgs()); } @@ -66,6 +68,7 @@ public String getDefaultArgs() { @Extension @Symbol("msbuild") public static class DescriptorImpl extends ToolDescriptor { + @Override public String getDisplayName() { return "MSBuild"; } diff --git a/src/test/java/hudson/plugins/msbuild/MsBuildKillingVetoTest.java b/src/test/java/hudson/plugins/msbuild/MsBuildKillingVetoTest.java index 7e99661..b73fbd1 100644 --- a/src/test/java/hudson/plugins/msbuild/MsBuildKillingVetoTest.java +++ b/src/test/java/hudson/plugins/msbuild/MsBuildKillingVetoTest.java @@ -78,6 +78,7 @@ public void testLeavesOthersAlone() { private IOSProcess mockProcess(final String... cmdLine) { return new IOSProcess() { + @Override public void killRecursively() throws InterruptedException { }