]> source.dussan.org Git - sonarqube.git/commitdiff
Fix some quality flaws
authorSimon Brandhof <simon.brandhof@gmail.com>
Fri, 16 Aug 2013 21:32:08 +0000 (23:32 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Fri, 16 Aug 2013 21:32:08 +0000 (23:32 +0200)
sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/SourceCode.java
sonar-graph/src/main/java/org/sonar/graph/Dsm.java
sonar-graph/src/main/java/org/sonar/graph/DsmTopologicalSorter.java
sonar-markdown/src/main/java/org/sonar/markdown/HtmlListChannel.java

index d44eef24e5a6dad5b5dc363bdd28b6f00399d7ba..9ee7749cc3cf854c81c3a136c670d186617b0295 100644 (file)
@@ -69,7 +69,7 @@ public class SourceCode {
         }
         return lines;
       } catch (Exception e) {
-        throw new RuntimeException("Problem while reading " + getFileName() + ":" + e.getMessage(), e);
+        throw new IllegalStateException("Problem while reading " + getFileName() + ":" + e.getMessage(), e);
       } finally {
         Closeables.closeQuietly(lnr);
       }
index 941ecbb2c1c47aaaf077c9803b432fd62ba3296f..8ac2715936d6cec396bd19b1b959070cac5aded4 100644 (file)
@@ -53,7 +53,7 @@ public class Dsm<V> {
         V to = vertices[y];
 
         Edge<V> edge = graph.getEdge(from, to);
-        boolean isFeedbackEdge = (edge != null && feedbackEdges.contains(edge));
+        boolean isFeedbackEdge = edge != null && feedbackEdges.contains(edge);
         DsmCell cell = new DsmCell(edge, isFeedbackEdge);
         cells[x][y] = cell;
       }
index b28685a9f862f1c00722ef18195d4d45c6ff9f06..85a77a91b7eef114987698f5637d3b412f1743b6 100644 (file)
@@ -39,7 +39,7 @@ public final class DsmTopologicalSorter<V> {
       boolean dsmCanBeSortedOnRight = partitionner.pushToRightVerticesWithoutOutgointEdges();
       dsmCanBeSorted = dsmCanBeSortedOnLeft || dsmCanBeSortedOnRight;
     }
-    boolean isCyclicGraph = (partitionner.leftOrderedIndex < partitionner.rightOrderedIndex);
+    boolean isCyclicGraph = partitionner.leftOrderedIndex < partitionner.rightOrderedIndex;
     if (isCyclicGraph) {
       throw new IllegalStateException("Can't sort a cyclic graph.");
     }
index 58fc67ea0fc7606bd5140eee4dd12d9eb704706a..9e24ffa91e6ae72323b388154bcc7aed3d639e04 100644 (file)
@@ -65,7 +65,7 @@ class HtmlListChannel extends Channel<MarkdownOutput> {
     private int searchIndexOfFirstCharacter(CharSequence token) {
       for (int index = 0; index < token.length(); index++) {
         if (token.charAt(index) == '*') {
-          for (index++; index < token.length(); index++) {
+          while (++index<token.length()) {
             if (token.charAt(index) != ' ') {
               return index;
             }