Skip to content

Commit

Permalink
Fix quality flaws
Browse files Browse the repository at this point in the history
  • Loading branch information
henryju committed Apr 6, 2018
1 parent 28cbd92 commit e74f63e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/main/java/hudson/plugins/sonar/SonarBuildWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@ static Map<String, String> createVars(SonarInstallation inst, EnvVars initialEnv
String token = getOrDefault(initialEnvironment.expand(inst.getServerAuthenticationToken()), "");
map.put("SONAR_AUTH_TOKEN", token);

if (StringUtils.isEmpty(inst.getMojoVersion())) {
String mojoVersion = inst.getMojoVersion();
if (StringUtils.isEmpty(mojoVersion)) {
map.put("SONAR_MAVEN_GOAL", "sonar:sonar");
} else {
map.put("SONAR_MAVEN_GOAL", SonarUtils.getMavenGoal(inst.getMojoVersion()));
map.put("SONAR_MAVEN_GOAL", SonarUtils.getMavenGoal(mojoVersion));
}

map.put("SONAR_EXTRA_PROPS", getOrDefault(initialEnvironment.expand(getAdditionalProps(inst)), ""));
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/hudson/plugins/sonar/utils/SonarMaven.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ public SonarMaven(String additionalProperties, String name, String pom, String j
* Visibility of a method has been relaxed for tests.
*/
static String getTarget(SonarInstallation installation) {
if (StringUtils.isBlank(installation.getMojoVersion())) {
String mojoVersion = installation.getMojoVersion();
if (StringUtils.isBlank(mojoVersion)) {
return TARGET + " sonar:sonar";
} else {
return TARGET + " " + SonarUtils.getMavenGoal(installation.getMojoVersion());
return TARGET + " " + SonarUtils.getMavenGoal(mojoVersion);
}
}

Expand Down

0 comments on commit e74f63e

Please sign in to comment.