aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-02-23 21:51:43 +0100
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-02-23 21:51:43 +0100
commitec5c44dd34ba4e77d43a0f6b67c9326a38c243dc (patch)
treeab0007c9768c6f8f3550a8686e7c0d8742c7d4b5 /server
parent1b2791924ef45c4b6a09d405deb3b1cfd5076798 (diff)
downloadsonarqube-ec5c44dd34ba4e77d43a0f6b67c9326a38c243dc.tar.gz
sonarqube-ec5c44dd34ba4e77d43a0f6b67c9326a38c243dc.zip
Fix quality flaws
Diffstat (limited to 'server')
-rw-r--r--server/sonar-process/src/main/java/org/sonar/process/LoopbackAddress.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/ParseReportStep.java9
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java5
-rw-r--r--server/sonar-ws-client/src/main/java/org/sonar/wsclient/services/WSUtils.java2
-rw-r--r--server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java2
5 files changed, 11 insertions, 9 deletions
diff --git a/server/sonar-process/src/main/java/org/sonar/process/LoopbackAddress.java b/server/sonar-process/src/main/java/org/sonar/process/LoopbackAddress.java
index 2302a626d2c..154fac61120 100644
--- a/server/sonar-process/src/main/java/org/sonar/process/LoopbackAddress.java
+++ b/server/sonar-process/src/main/java/org/sonar/process/LoopbackAddress.java
@@ -27,7 +27,7 @@ import java.util.Enumeration;
public class LoopbackAddress {
- private static InetAddress instance;
+ private static volatile InetAddress instance;
private LoopbackAddress() {
// only static stuff
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/ParseReportStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/ParseReportStep.java
index 042f13e7c4a..9d6f4a547e4 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/ParseReportStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/ParseReportStep.java
@@ -92,10 +92,11 @@ public class ParseReportStep implements ComputationStep {
private void recursivelyProcessComponent(BatchOutputReader reportReader, ComputationContext context, int componentRef) {
BatchReport.Component component = reportReader.readComponent(componentRef);
- issueComputation.processComponentIssues(context, component.getUuid(), reportReader.readComponentIssues(componentRef));
-
- for (Integer childRef : component.getChildRefsList()) {
- recursivelyProcessComponent(reportReader, context, childRef);
+ if (component != null) {
+ issueComputation.processComponentIssues(context, component.getUuid(), reportReader.readComponentIssues(componentRef));
+ for (Integer childRef : component.getChildRefsList()) {
+ recursivelyProcessComponent(reportReader, context, childRef);
+ }
}
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java
index eb1a6f9b7c7..b719d076766 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java
@@ -45,6 +45,7 @@ import org.sonar.api.issue.Issue;
import org.sonar.api.rule.Severity;
import org.sonar.api.utils.DateUtils;
import org.sonar.api.utils.System2;
+import org.sonar.core.util.NonNullInputFunction;
import org.sonar.server.es.*;
import org.sonar.server.exceptions.NotFoundException;
import org.sonar.server.issue.IssueQuery;
@@ -101,9 +102,9 @@ public class IssueIndex extends BaseIndex {
* Convert an Elasticsearch result (a map) to an {@link org.sonar.server.issue.index.IssueDoc}. It's
* used for {@link org.sonar.server.es.SearchResult}.
*/
- private static final Function<Map<String, Object>, IssueDoc> DOC_CONVERTER = new Function<Map<String, Object>, IssueDoc>() {
+ private static final Function<Map<String, Object>, IssueDoc> DOC_CONVERTER = new NonNullInputFunction<Map<String,Object>, IssueDoc>() {
@Override
- public IssueDoc apply(Map<String, Object> input) {
+ protected IssueDoc doApply(Map<String, Object> input) {
return new IssueDoc(input);
}
};
diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/services/WSUtils.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/services/WSUtils.java
index 188204771b3..0c8dab2f8a9 100644
--- a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/services/WSUtils.java
+++ b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/services/WSUtils.java
@@ -31,7 +31,7 @@ import java.util.Set;
*/
public abstract class WSUtils {
- private static WSUtils instance = null;
+ private static volatile WSUtils instance = null;
public static void setInstance(WSUtils utils) {
instance = utils;
diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java
index 094bc270cd3..654e72fbb98 100644
--- a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java
+++ b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java
@@ -28,7 +28,7 @@ public final class Unmarshallers {
private Unmarshallers() {
}
- private static Map<Class, Unmarshaller> unmarshallers;
+ private static volatile Map<Class, Unmarshaller> unmarshallers;
static {
unmarshallers = new HashMap<Class, Unmarshaller>();