Skip to content

Commit

Permalink
Merge pull request #28 from mdkf/master
Browse files Browse the repository at this point in the history
Fixed some minor build warnings/findbugs
  • Loading branch information
marshall777 authored Feb 1, 2017
2 parents 1449bfa + 7a4cd6b commit 304472d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.6</version>
<version>2.20</version>
</parent>

<artifactId>msbuild</artifactId>
Expand Down
1 change: 1 addition & 0 deletions src/main/java/hudson/plugins/msbuild/MSBuildErrorNote.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/hudson/plugins/msbuild/MsBuildBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListen

//Build /P:key1=value1;key2=value2 ...
Map<String, String> propertiesVariables = getPropertiesVariables(build);
if (buildVariablesAsProperties && propertiesVariables.size() != 0) {
if (buildVariablesAsProperties && !propertiesVariables.isEmpty()) {
StringBuffer parameters = new StringBuffer();
parameters.append("/p:");
for (Map.Entry<String, String> entry : propertiesVariables.entrySet()) {
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -223,7 +223,7 @@ private Map<String, String> getPropertiesVariables(AbstractBuild build) {
Map<String, String> buildVariables = build.getBuildVariables();

final Set<String> sensitiveBuildVariables = build.getSensitiveBuildVariables();
if (sensitiveBuildVariables == null || sensitiveBuildVariables.size() == 0) {
if (sensitiveBuildVariables == null || sensitiveBuildVariables.isEmpty()) {
return buildVariables;
}

Expand Down Expand Up @@ -258,7 +258,7 @@ static String getToolFullPath(Launcher launcher, String pathToTool, String execN

@Override
public Descriptor<Builder> getDescriptor() {
return (DescriptorImpl) super.getDescriptor();
return super.getDescriptor();
}

/**
Expand Down Expand Up @@ -292,6 +292,7 @@ public DescriptorImpl() {
load();
}

@Override
public String getDisplayName() {
return Messages.MsBuildBuilder_DisplayName();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,20 @@
*/
public final class MsBuildInstallation extends ToolInstallation implements NodeSpecific<MsBuildInstallation>, EnvironmentSpecific<MsBuildInstallation> {

private String defaultArgs;
private final String defaultArgs;

@DataBoundConstructor
public MsBuildInstallation(String name, String home, String defaultArgs) {
super(name, home, null);
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());
}
Expand All @@ -66,6 +68,7 @@ public String getDefaultArgs() {
@Extension @Symbol("msbuild")
public static class DescriptorImpl extends ToolDescriptor<MsBuildInstallation> {

@Override
public String getDisplayName() {
return "MSBuild";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public void testLeavesOthersAlone() {

private IOSProcess mockProcess(final String... cmdLine) {
return new IOSProcess() {
@Override
public void killRecursively() throws InterruptedException {
}

Expand Down

0 comments on commit 304472d

Please sign in to comment.