aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-server
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2014-08-26 18:28:55 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2014-08-26 18:45:51 +0200
commitc2d7e44f722f3c14af036553fdc001408f47343a (patch)
treebd11dfa755ee93946cc5e5197fcadd271aad83f3 /server/sonar-server
parentcd5e247daf7096f3c62ada0c65d2657b954195c1 (diff)
downloadsonarqube-c2d7e44f722f3c14af036553fdc001408f47343a.tar.gz
sonarqube-c2d7e44f722f3c14af036553fdc001408f47343a.zip
Fix some quality flaws
Diffstat (limited to 'server/sonar-server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/app/Connectors.java36
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/app/EmbeddedTomcat.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/app/Logging.java10
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/app/Webapp.java10
4 files changed, 29 insertions, 29 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/app/Connectors.java b/server/sonar-server/src/main/java/org/sonar/server/app/Connectors.java
index 13276f34dbf..340c3b3ccbf 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/app/Connectors.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/app/Connectors.java
@@ -70,7 +70,7 @@ class Connectors {
private static Connector newHttpConnector(Props props) {
Connector connector = null;
// Not named "sonar.web.http.port" to keep backward-compatibility
- int port = props.intOf("sonar.web.port", 9000);
+ int port = props.valueAsInt("sonar.web.port", 9000);
if (port > DISABLED_PORT) {
connector = newConnector(props, HTTP_PROTOCOL, "http");
connector.setPort(port);
@@ -82,7 +82,7 @@ class Connectors {
@Nullable
private static Connector newAjpConnector(Props props) {
Connector connector = null;
- int port = props.intOf("sonar.ajp.port", DISABLED_PORT);
+ int port = props.valueAsInt("sonar.ajp.port", DISABLED_PORT);
if (port > DISABLED_PORT) {
connector = newConnector(props, AJP_PROTOCOL, "http");
connector.setPort(port);
@@ -94,24 +94,24 @@ class Connectors {
@Nullable
private static Connector newHttpsConnector(Props props) {
Connector connector = null;
- int port = props.intOf("sonar.web.https.port", DISABLED_PORT);
+ int port = props.valueAsInt("sonar.web.https.port", DISABLED_PORT);
if (port > DISABLED_PORT) {
connector = newConnector(props, HTTP_PROTOCOL, "https");
connector.setPort(port);
connector.setSecure(true);
connector.setScheme("https");
- setConnectorAttribute(connector, "keyAlias", props.of("sonar.web.https.keyAlias"));
- String keyPassword = props.of("sonar.web.https.keyPass", "changeit");
+ setConnectorAttribute(connector, "keyAlias", props.value("sonar.web.https.keyAlias"));
+ String keyPassword = props.value("sonar.web.https.keyPass", "changeit");
setConnectorAttribute(connector, "keyPass", keyPassword);
- setConnectorAttribute(connector, "keystorePass", props.of("sonar.web.https.keystorePass", keyPassword));
- setConnectorAttribute(connector, "keystoreFile", props.of("sonar.web.https.keystoreFile"));
- setConnectorAttribute(connector, "keystoreType", props.of("sonar.web.https.keystoreType", "JKS"));
- setConnectorAttribute(connector, "keystoreProvider", props.of("sonar.web.https.keystoreProvider"));
- setConnectorAttribute(connector, "truststorePass", props.of("sonar.web.https.truststorePass", "changeit"));
- setConnectorAttribute(connector, "truststoreFile", props.of("sonar.web.https.truststoreFile"));
- setConnectorAttribute(connector, "truststoreType", props.of("sonar.web.https.truststoreType", "JKS"));
- setConnectorAttribute(connector, "truststoreProvider", props.of("sonar.web.https.truststoreProvider"));
- setConnectorAttribute(connector, "clientAuth", props.of("sonar.web.https.clientAuth", "false"));
+ setConnectorAttribute(connector, "keystorePass", props.value("sonar.web.https.keystorePass", keyPassword));
+ setConnectorAttribute(connector, "keystoreFile", props.value("sonar.web.https.keystoreFile"));
+ setConnectorAttribute(connector, "keystoreType", props.value("sonar.web.https.keystoreType", "JKS"));
+ setConnectorAttribute(connector, "keystoreProvider", props.value("sonar.web.https.keystoreProvider"));
+ setConnectorAttribute(connector, "truststorePass", props.value("sonar.web.https.truststorePass", "changeit"));
+ setConnectorAttribute(connector, "truststoreFile", props.value("sonar.web.https.truststoreFile"));
+ setConnectorAttribute(connector, "truststoreType", props.value("sonar.web.https.truststoreType", "JKS"));
+ setConnectorAttribute(connector, "truststoreProvider", props.value("sonar.web.https.truststoreProvider"));
+ setConnectorAttribute(connector, "clientAuth", props.value("sonar.web.https.clientAuth", "false"));
setConnectorAttribute(connector, "sslProtocol", "TLS");
setConnectorAttribute(connector, "SSLEnabled", true);
info("HTTPS connector is enabled on port " + port);
@@ -122,7 +122,7 @@ class Connectors {
private static Connector newConnector(Props props, String protocol, String scheme) {
Connector connector = new Connector(protocol);
connector.setURIEncoding("UTF-8");
- connector.setProperty("address", props.of("sonar.web.host", "0.0.0.0"));
+ connector.setProperty("address", props.value("sonar.web.host", "0.0.0.0"));
configurePool(props, connector, scheme);
configureCompression(connector);
return connector;
@@ -130,9 +130,9 @@ class Connectors {
private static void configurePool(Props props, Connector connector, String scheme) {
connector.setProperty("acceptorThreadCount", String.valueOf(2));
- connector.setProperty("minSpareThreads", String.valueOf(props.intOf("sonar.web." + scheme + ".minThreads", 5)));
- connector.setProperty("maxThreads", String.valueOf(props.intOf("sonar.web." + scheme + ".maxThreads", 50)));
- connector.setProperty("acceptCount", String.valueOf(props.intOf("sonar.web." + scheme + ".acceptCount", 25)));
+ connector.setProperty("minSpareThreads", String.valueOf(props.valueAsInt("sonar.web." + scheme + ".minThreads", 5)));
+ connector.setProperty("maxThreads", String.valueOf(props.valueAsInt("sonar.web." + scheme + ".maxThreads", 50)));
+ connector.setProperty("acceptCount", String.valueOf(props.valueAsInt("sonar.web." + scheme + ".acceptCount", 25)));
}
private static void configureCompression(Connector connector) {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/app/EmbeddedTomcat.java b/server/sonar-server/src/main/java/org/sonar/server/app/EmbeddedTomcat.java
index f86e5cc369d..8a80a6c05ec 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/app/EmbeddedTomcat.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/app/EmbeddedTomcat.java
@@ -80,7 +80,7 @@ class EmbeddedTomcat implements Terminable {
}
private File tomcatBasedir() {
- return new File(props.of("sonar.path.temp"), "tc");
+ return new File(props.value("sonar.path.temp"), "tc");
}
boolean isReady() {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/app/Logging.java b/server/sonar-server/src/main/java/org/sonar/server/app/Logging.java
index 0610bcdd7ed..777a06883cb 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/app/Logging.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/app/Logging.java
@@ -66,11 +66,11 @@ class Logging {
* Configure Logback from classpath, with configuration from sonar.properties
*/
private static void configureLogback(Props props) {
- String configProfilingLevel = props.of(Profiling.CONFIG_PROFILING_LEVEL, "NONE");
+ String configProfilingLevel = props.value(Profiling.CONFIG_PROFILING_LEVEL, "NONE");
Profiling.Level profilingLevel = Profiling.Level.fromConfigString(configProfilingLevel);
- String consoleEnabled = props.of(CONFIG_LOG_CONSOLE, "false");
+ String consoleEnabled = props.value(CONFIG_LOG_CONSOLE, "false");
Map<String, String> variables = ImmutableMap.of(
- "sonar.path.logs", props.of("sonar.path.logs"),
+ "sonar.path.logs", props.nonNullValue("sonar.path.logs"),
"LOGFILE_LOGGING_FORMAT", profilingLevel == Profiling.Level.FULL ? LOGFILE_FULL_LOGGING_FORMAT : LOGFILE_STANDARD_LOGGING_FORMAT,
"CONSOLE_LOGGING_FORMAT", profilingLevel == Profiling.Level.FULL ? CONSOLE_FULL_LOGGING_FORMAT : CONSOLE_STANDARD_LOGGING_FORMAT,
"CONSOLE_ENABLED", consoleEnabled);
@@ -84,10 +84,10 @@ class Logging {
}
private static void configureLogbackAccess(Tomcat tomcat, Props props) {
- if (props.booleanOf(PROPERTY_ENABLE_ACCESS_LOGS, true)) {
+ if (props.valueAsBoolean(PROPERTY_ENABLE_ACCESS_LOGS, true)) {
LogbackValve valve = new LogbackValve();
valve.setQuiet(true);
- valve.setFilename(new File(props.of("sonar.path.web"), ACCESS_RELATIVE_PATH).getAbsolutePath());
+ valve.setFilename(new File(props.nonNullValue("sonar.path.web"), ACCESS_RELATIVE_PATH).getAbsolutePath());
tomcat.getHost().getPipeline().addValve(valve);
}
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/app/Webapp.java b/server/sonar-server/src/main/java/org/sonar/server/app/Webapp.java
index 45b5be863a8..006bbafd237 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/app/Webapp.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/app/Webapp.java
@@ -70,7 +70,7 @@ class Webapp {
}
static String getContextPath(Props props) {
- String context = props.of(PROPERTY_CONTEXT, "");
+ String context = props.value(PROPERTY_CONTEXT, "");
if ("/".equals(context)) {
context = "";
} else if (!"".equals(context) && !context.startsWith("/")) {
@@ -81,10 +81,10 @@ class Webapp {
static void configureRails(Props props, Context context) {
// sonar.dev is kept for backward-compatibility
- if (props.booleanOf("sonar.dev", false)) {
+ if (props.valueAsBoolean("sonar.dev", false)) {
props.set("sonar.web.dev", "true");
}
- if (props.booleanOf("sonar.web.dev", false)) {
+ if (props.valueAsBoolean("sonar.web.dev", false)) {
context.addParameter(RAILS_ENV, "development");
context.addParameter(JRUBY_MAX_RUNTIMES, "3");
LoggerFactory.getLogger(Webapp.class).warn("WEB DEVELOPMENT MODE IS ENABLED - DO NOT USE FOR PRODUCTION USAGE");
@@ -95,9 +95,9 @@ class Webapp {
}
static String webappPath(Props props) {
- String webDir = props.of("sonar.web.dev.sources");
+ String webDir = props.value("sonar.web.dev.sources");
if (StringUtils.isEmpty(webDir)) {
- webDir = new File(props.of("sonar.path.home"), "web").getAbsolutePath();
+ webDir = new File(props.value("sonar.path.home"), "web").getAbsolutePath();
}
LoggerFactory.getLogger(Webapp.class).info(String.format("Webapp directory: %s", webDir));
return webDir;