aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-graph
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-04-01 23:56:50 +0200
committersimonbrandhof <simon.brandhof@gmail.com>2011-04-01 23:56:50 +0200
commit9380e275b3c6267ef3b958e5a0127dd924cab493 (patch)
treed716d7a0ee7c98bff298261a8573585636537fe1 /sonar-graph
parent181e104170afc8019cac4fb906bc292320df0da0 (diff)
downloadsonarqube-9380e275b3c6267ef3b958e5a0127dd924cab493.tar.gz
sonarqube-9380e275b3c6267ef3b958e5a0127dd924cab493.zip
Fix some violations
Diffstat (limited to 'sonar-graph')
-rw-r--r--sonar-graph/src/main/java/org/sonar/graph/DsmScanner.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/sonar-graph/src/main/java/org/sonar/graph/DsmScanner.java b/sonar-graph/src/main/java/org/sonar/graph/DsmScanner.java
index c69a2708e62..7d24b3adee7 100644
--- a/sonar-graph/src/main/java/org/sonar/graph/DsmScanner.java
+++ b/sonar-graph/src/main/java/org/sonar/graph/DsmScanner.java
@@ -19,6 +19,8 @@
*/
package org.sonar.graph;
+import org.apache.commons.lang.ArrayUtils;
+
import java.io.IOException;
import java.io.LineNumberReader;
import java.io.Reader;
@@ -56,17 +58,15 @@ public final class DsmScanner {
private void readRow(int i) throws IOException {
String[] tokens = splitLine(reader.readLine());
- if (tokens != null) {
- for (int j = 1; j < tokens.length - 1; j++) {
- int toVertexIndex = j - 1;
- int weight = extractWeight(tokens[j]);
- if (i != toVertexIndex) {
- StringEdge edge = new StringEdge(vertices[toVertexIndex], vertices[i], weight);
- if (isFeedbackEdge(tokens[j])) {
- feedbackEdges.add(edge);
- }
- graph.addEdge(edge);
+ for (int j = 1; j < tokens.length - 1; j++) {
+ int toVertexIndex = j - 1;
+ int weight = extractWeight(tokens[j]);
+ if (i != toVertexIndex) {
+ StringEdge edge = new StringEdge(vertices[toVertexIndex], vertices[i], weight);
+ if (isFeedbackEdge(tokens[j])) {
+ feedbackEdges.add(edge);
}
+ graph.addEdge(edge);
}
}
}
@@ -93,6 +93,9 @@ public final class DsmScanner {
}
private String[] splitLine(String line) {
+ if (line == null) {
+ return ArrayUtils.EMPTY_STRING_ARRAY;
+ }
String[] tokens = line.split("\\" + CELL_SEPARATOR);
String[] result = new String[tokens.length];
for (int i = 0; i < tokens.length; i++) {