Skip to content
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

Fixed some minor build warnings/findbugs #28

Merged
merged 1 commit into from
Feb 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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