aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-01-29 11:31:16 +0100
committerJulien Lancelot <julien.lancelot@gmail.com>2013-01-29 11:31:16 +0100
commit547e931f01aab57a668f46c600c368103276d441 (patch)
treef4c7e8292b24161fa229f3423538dbae9d2231fe /sonar-core
parent86199f0cbaeb53ce5419d9617b8ff5e46cc225c4 (diff)
downloadsonarqube-547e931f01aab57a668f46c600c368103276d441.tar.gz
sonarqube-547e931f01aab57a668f46c600c368103276d441.zip
SONAR-2501 Replace Set by List for covers method (because Set is not supported when reading a graph from Json)
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/graph/graphson/GraphsonUtil.java8
-rw-r--r--sonar-core/src/main/java/org/sonar/core/test/DefaultTestCase.java3
2 files changed, 6 insertions, 5 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/graph/graphson/GraphsonUtil.java b/sonar-core/src/main/java/org/sonar/core/graph/graphson/GraphsonUtil.java
index ef7e27e0f3f..73d195f8af3 100644
--- a/sonar-core/src/main/java/org/sonar/core/graph/graphson/GraphsonUtil.java
+++ b/sonar-core/src/main/java/org/sonar/core/graph/graphson/GraphsonUtil.java
@@ -110,7 +110,7 @@ class GraphsonUtil {
*/
static JSONObject jsonFromElement(Element element, @Nullable Set<String> propertyKeys, GraphsonMode mode) {
GraphsonUtil graphson = element instanceof Edge ? new GraphsonUtil(mode, null, null, propertyKeys)
- : new GraphsonUtil(mode, null, propertyKeys, null);
+ : new GraphsonUtil(mode, null, propertyKeys, null);
return graphson.jsonFromElement(element);
}
@@ -249,7 +249,7 @@ class GraphsonUtil {
private static boolean isReservedKey(String key) {
return key.equals(GraphsonTokens._ID) || key.equals(GraphsonTokens._TYPE) || key.equals(GraphsonTokens._LABEL)
- || key.equals(GraphsonTokens._OUT_V) || key.equals(GraphsonTokens._IN_V);
+ || key.equals(GraphsonTokens._OUT_V) || key.equals(GraphsonTokens._IN_V);
}
private static JSONArray createJSONList(List list, Set<String> propertyKeys, boolean showTypes) {
@@ -264,6 +264,8 @@ class GraphsonUtil {
jsonList.add(createJSONMap((Map) item, propertyKeys, showTypes));
} else if (item != null && item.getClass().isArray()) {
jsonList.add(createJSONList(convertArrayToList(item), propertyKeys, showTypes));
+ } else if (item instanceof Set) {
+ throw new UnsupportedOperationException("Set property is not supported");
} else {
addObject(jsonList, item);
}
@@ -283,7 +285,7 @@ class GraphsonUtil {
value = createJSONMap((Map) value, propertyKeys, showTypes);
} else if (value instanceof Element) {
value = jsonFromElement((Element) value, propertyKeys,
- showTypes ? GraphsonMode.EXTENDED : GraphsonMode.NORMAL);
+ showTypes ? GraphsonMode.EXTENDED : GraphsonMode.NORMAL);
} else if (value.getClass().isArray()) {
value = createJSONList(convertArrayToList(value), propertyKeys, showTypes);
}
diff --git a/sonar-core/src/main/java/org/sonar/core/test/DefaultTestCase.java b/sonar-core/src/main/java/org/sonar/core/test/DefaultTestCase.java
index 53febd013dc..1bb55ed23cd 100644
--- a/sonar-core/src/main/java/org/sonar/core/test/DefaultTestCase.java
+++ b/sonar-core/src/main/java/org/sonar/core/test/DefaultTestCase.java
@@ -37,7 +37,6 @@ import javax.annotation.Nullable;
import java.util.Collection;
import java.util.List;
-import java.util.Set;
public class DefaultTestCase extends BeanVertex implements MutableTestCase {
@@ -105,7 +104,7 @@ public class DefaultTestCase extends BeanVertex implements MutableTestCase {
return this;
}
- public void covers(Testable testable, Set<Integer> lines) {
+ public void covers(Testable testable, List<Integer> lines) {
LOG.info("Covers : " + testable.component().key(), " on "+ lines);
Vertex componentVertex = GraphUtil.single(beanGraph().getUnderlyingGraph().getVertices("key", testable.component().key()));