aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2016-01-04 13:47:47 +0100
committerSimon Brandhof <simon.brandhof@sonarsource.com>2016-01-04 13:47:47 +0100
commitbd0f794ad863cc9e0685b911c5ca93104c69f774 (patch)
treecf4892e9c5ef45cf80d5bf94190bd4013007495e
parent1cb57e36cede4525de1803c8cd827d2e7309bb1b (diff)
downloadsonarqube-bd0f794ad863cc9e0685b911c5ca93104c69f774.tar.gz
sonarqube-bd0f794ad863cc9e0685b911c5ca93104c69f774.zip
Fix quality flaws
-rw-r--r--server/sonar-process/src/main/java/org/sonar/process/MinimumViableSystem.java1
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/log/LogFileRef.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterFactory.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/MasterServletFilter.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CreateAction.java3
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java2
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/HttpConnector.java1
7 files changed, 6 insertions, 7 deletions
diff --git a/server/sonar-process/src/main/java/org/sonar/process/MinimumViableSystem.java b/server/sonar-process/src/main/java/org/sonar/process/MinimumViableSystem.java
index 4b182468fb3..881fcb5e5be 100644
--- a/server/sonar-process/src/main/java/org/sonar/process/MinimumViableSystem.java
+++ b/server/sonar-process/src/main/java/org/sonar/process/MinimumViableSystem.java
@@ -24,7 +24,6 @@ import org.apache.commons.lang.StringUtils;
import java.io.File;
import java.io.IOException;
-import java.util.HashMap;
import java.util.Map;
import static java.lang.String.format;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/log/LogFileRef.java b/server/sonar-server/src/main/java/org/sonar/server/computation/log/LogFileRef.java
index 3378f4805e5..415b074d23f 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/log/LogFileRef.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/log/LogFileRef.java
@@ -79,7 +79,7 @@ public class LogFileRef {
if (!taskUuid.equals(that.taskUuid)) {
return false;
}
- return componentUuid == null ? that.componentUuid == null : componentUuid.equals(that.componentUuid);
+ return componentUuid == null ? (that.componentUuid == null) : componentUuid.equals(that.componentUuid);
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterFactory.java b/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterFactory.java
index 20cd4b2f589..fc0db747132 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterFactory.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterFactory.java
@@ -187,7 +187,7 @@ public class MeasureFilterFactory {
@CheckForNull
private Date toDays(@Nullable String s) {
if (s != null) {
- int days = Integer.valueOf(s);
+ int days = Integer.parseInt(s);
Date date = org.apache.commons.lang.time.DateUtils.truncate(new Date(system.now()), Calendar.DATE);
date = org.apache.commons.lang.time.DateUtils.addDays(date, -days);
return date;
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/MasterServletFilter.java b/server/sonar-server/src/main/java/org/sonar/server/platform/MasterServletFilter.java
index 473d8c51f7b..d35abe3f1f7 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/MasterServletFilter.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/platform/MasterServletFilter.java
@@ -64,7 +64,7 @@ public class MasterServletFilter implements Filter {
}
public void initFilters(List<ServletFilter> filterExtensions) throws ServletException {
- List<Filter> filterList = Lists.newArrayList();
+ List<ServletFilter> filterList = Lists.newArrayList();
for (ServletFilter extension : filterExtensions) {
try {
Loggers.get(MasterServletFilter.class).info(String.format("Initializing servlet filter %s [pattern=%s]", extension, extension.doGetPattern()));
diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CreateAction.java
index 10aa71531f1..70bc85bdb1d 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CreateAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/CreateAction.java
@@ -21,6 +21,7 @@ package org.sonar.server.qualityprofile.ws;
import java.io.InputStream;
import java.io.OutputStreamWriter;
+import java.nio.charset.StandardCharsets;
import org.sonar.api.profiles.ProfileImporter;
import org.sonar.api.resources.Languages;
import org.sonar.api.server.ws.Request;
@@ -119,7 +120,7 @@ public class CreateAction implements QProfileWsAction {
dbSession.commit();
response.stream().setMediaType(guessMediaType(request));
- JsonWriter jsonWriter = JsonWriter.of(new OutputStreamWriter(response.stream().output()));
+ JsonWriter jsonWriter = JsonWriter.of(new OutputStreamWriter(response.stream().output(), StandardCharsets.UTF_8));
writeResult(jsonWriter, result);
} finally {
dbSession.close();
diff --git a/server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java b/server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java
index 7a9ae4616f6..35fd0822b3d 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/test/ws/ListAction.java
@@ -167,7 +167,7 @@ public class ListAction implements TestsWsAction {
}
responseBuilder.addTests(testBuilder.build());
}
- WsUtils.writeProtobuf(responseBuilder.build(), request, response);
+ WsUtils.writeProtobuf(responseBuilder.build(), request, response);
}
private static int coveredLines(List<CoveredFileDoc> coveredFiles) {
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/HttpConnector.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/HttpConnector.java
index 52e5c805c1b..42e2c52874e 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/HttpConnector.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/HttpConnector.java
@@ -54,7 +54,6 @@ public class HttpConnector implements WsConnector {
public static final int DEFAULT_CONNECT_TIMEOUT_MILLISECONDS = 30_000;
public static final int DEFAULT_READ_TIMEOUT_MILLISECONDS = 60_000;
- public static final String[] TLS_PROTOCOLS = new String[] {"TLSv1", "TLSv1.1", "TLSv1.2"};
/**
* Base URL with trailing slash, for instance "https://localhost/sonarqube/".