From 1493707a0c2acc5470adf281167eaeebb0272d50 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Tue, 15 Mar 2016 12:05:23 +0100 Subject: Fix quality flaws --- sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java | 3 ++- sonar-batch/src/main/java/org/sonar/batch/rule/QProfileVerifier.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'sonar-batch') diff --git a/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java b/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java index c62ccd63c56..4654892fb57 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java +++ b/sonar-batch/src/main/java/org/sonar/batch/report/ReportPublisher.java @@ -52,6 +52,7 @@ import org.sonarqube.ws.WsCe; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsResponse; +import static org.apache.commons.lang.StringUtils.trimToEmpty; import static org.sonar.core.util.FileUtils.deleteQuietly; @BatchSide @@ -230,7 +231,7 @@ public class ReportPublisher implements Startable { * See https://jira.sonarsource.com/browse/SONAR-4239 */ private String publicUrl() { - String baseUrl = settings.getString(CoreProperties.SERVER_BASE_URL); + String baseUrl = trimToEmpty(settings.getString(CoreProperties.SERVER_BASE_URL)); if (baseUrl.equals(settings.getDefaultValue(CoreProperties.SERVER_BASE_URL))) { // crap workaround for https://jira.sonarsource.com/browse/SONAR-7109 // If server base URL was not configured in Sonar server then is is better to take URL configured on batch side diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileVerifier.java b/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileVerifier.java index 00ecc85f700..6206a289f17 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileVerifier.java +++ b/sonar-batch/src/main/java/org/sonar/batch/rule/QProfileVerifier.java @@ -28,6 +28,8 @@ import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.config.Settings; import org.sonar.api.utils.MessageException; +import static org.apache.commons.lang.StringUtils.isNotEmpty; + @BatchSide public class QProfileVerifier { @@ -57,7 +59,7 @@ public class QProfileVerifier { logger.warn("No Quality profile found for language " + lang); } else { logger.info("Quality profile for {}: {}", lang, profile.getName()); - if (StringUtils.isNotBlank(defaultName) && defaultName.equals(profile.getName())) { + if (isNotEmpty(defaultName) && defaultName.equals(profile.getName())) { defaultNameUsed = true; } } -- cgit v1.2.3