From 31c56c4337d47b6e0486c8ceb2815c7fa1173dcc Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Date: Tue, 1 Jul 2014 14:46:18 +0200
Subject: Fix quality flaws

---
 .../org/sonar/markdown/HtmlBlockquoteChannel.java     | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

(limited to 'sonar-markdown/src')

diff --git a/sonar-markdown/src/main/java/org/sonar/markdown/HtmlBlockquoteChannel.java b/sonar-markdown/src/main/java/org/sonar/markdown/HtmlBlockquoteChannel.java
index 286e7e58c80..da1594d9a30 100644
--- a/sonar-markdown/src/main/java/org/sonar/markdown/HtmlBlockquoteChannel.java
+++ b/sonar-markdown/src/main/java/org/sonar/markdown/HtmlBlockquoteChannel.java
@@ -47,14 +47,12 @@ class HtmlBlockquoteChannel extends Channel<MarkdownOutput> {
   @Override
   public boolean consume(CodeReader code, MarkdownOutput output) {
     try {
-      if (code.getColumnPosition() == 0) {
-        if (quotedLineElement.consume(code, output)) {
-          while (endOfLine.consume(code, output) && quotedLineElement.consume(code, output)) {
-            // consume input
-          }
-          output.append("</blockquote>");
-          return true;
+      if (code.getColumnPosition() == 0 && quotedLineElement.consume(code, output)) {
+        while (endOfLine.consume(code, output) && quotedLineElement.consume(code, output)) {
+          // consume input
         }
+        output.append("</blockquote>");
+        return true;
       }
       return false;
     } finally {
@@ -79,15 +77,18 @@ class HtmlBlockquoteChannel extends Channel<MarkdownOutput> {
     }
 
     private int searchIndexOfFirstCharacter(CharSequence token) {
-      for (int index = 0; index < token.length(); index++) {
+      int index = 0;
+      while (index < token.length()) {
         if (token.charAt(index) == '&') {
           index += 4;
-          while (++ index < token.length()) {
+          while (index < token.length()) {
+            index ++;
             if (token.charAt(index) != ' ') {
               return index;
             }
           }
         }
+        index ++;
       }
       return token.length() - 1;
     }
-- 
cgit v1.2.3