From 129d630f52bd531f070969d806166f8c70593751 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 11 Nov 2016 12:34:11 +0100 Subject: [PATCH] Fix Quality flaws around NPE --- .../java/org/sonar/server/plugins/ws/PluginWSCommons.java | 4 +++- .../java/org/sonar/server/qualitygate/ws/DeselectAction.java | 2 +- .../java/org/sonar/server/qualitygate/ws/SelectAction.java | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/plugins/ws/PluginWSCommons.java b/server/sonar-server/src/main/java/org/sonar/server/plugins/ws/PluginWSCommons.java index 2bace234654..63012719a7c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/plugins/ws/PluginWSCommons.java +++ b/server/sonar-server/src/main/java/org/sonar/server/plugins/ws/PluginWSCommons.java @@ -29,6 +29,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Map; +import javax.annotation.CheckForNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.sonar.api.utils.text.JsonWriter; @@ -269,7 +270,8 @@ public class PluginWSCommons { } } - static String categoryOrNull(Plugin plugin) { + @CheckForNull + static String categoryOrNull(@Nullable Plugin plugin) { return plugin != null ? plugin.getCategory() : null; } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeselectAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeselectAction.java index 29c947d5afa..b90315ff228 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeselectAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/DeselectAction.java @@ -20,7 +20,7 @@ package org.sonar.server.qualitygate.ws; import com.google.common.base.Optional; -import org.elasticsearch.common.Nullable; +import javax.annotation.Nullable; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java index c4ea2e424e7..318c11ee04e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/ws/SelectAction.java @@ -20,7 +20,7 @@ package org.sonar.server.qualitygate.ws; import com.google.common.base.Optional; -import org.elasticsearch.common.Nullable; +import javax.annotation.Nullable; import org.sonar.api.server.ws.Request; import org.sonar.api.server.ws.Response; import org.sonar.api.server.ws.WebService; -- 2.39.5