package org.sonar.server.db;
import com.google.common.annotations.VisibleForTesting;
+import org.apache.commons.lang.StringUtils;
import org.picocontainer.Startable;
import org.sonar.api.config.Settings;
import org.sonar.api.database.DatabaseProperties;
+import static org.apache.commons.lang.StringUtils.startsWith;
+
public class EmbeddedDatabaseFactory implements Startable {
private final Settings settings;
private EmbeddedDatabase embeddedDatabase;
public void start() {
if (embeddedDatabase == null) {
String jdbcUrl = settings.getString(DatabaseProperties.PROP_URL);
- if (jdbcUrl.startsWith("jdbc:h2:tcp:")) {
+ if (startsWith(jdbcUrl, "jdbc:h2:tcp:")) {
embeddedDatabase = getEmbeddedDatabase(settings);
embeddedDatabase.start();
}
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
* 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
import org.sonar.api.config.Settings;
import org.sonar.api.utils.MessageException;
+import static org.apache.commons.lang.StringUtils.isNotEmpty;
+
@BatchSide
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;
}
}