From: Jean-Baptiste Lievremont Date: Tue, 1 Jul 2014 12:46:18 +0000 (+0200) Subject: Fix quality flaws X-Git-Tag: 4.4-RC1~60 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=31c56c4337d47b6e0486c8ceb2815c7fa1173dcc;p=sonarqube.git Fix quality flaws --- diff --git a/sonar-core/src/main/java/org/sonar/core/profiling/LoggingWatch.java b/sonar-core/src/main/java/org/sonar/core/profiling/LoggingWatch.java index 18112bcf8a2..d0ef0c47510 100644 --- a/sonar-core/src/main/java/org/sonar/core/profiling/LoggingWatch.java +++ b/sonar-core/src/main/java/org/sonar/core/profiling/LoggingWatch.java @@ -23,7 +23,7 @@ import com.google.common.annotations.VisibleForTesting; import org.slf4j.Logger; import org.sonar.api.utils.System2; -class LoggingWatch extends StopWatch { +class LoggingWatch implements StopWatch { private Logger logger; private System2 system; diff --git a/sonar-core/src/main/java/org/sonar/core/profiling/NoopWatch.java b/sonar-core/src/main/java/org/sonar/core/profiling/NoopWatch.java index 419012500b8..61b9a30271c 100644 --- a/sonar-core/src/main/java/org/sonar/core/profiling/NoopWatch.java +++ b/sonar-core/src/main/java/org/sonar/core/profiling/NoopWatch.java @@ -20,7 +20,7 @@ package org.sonar.core.profiling; -class NoopWatch extends StopWatch { +class NoopWatch implements StopWatch { @Override public void stop(String message, Object... args) { diff --git a/sonar-core/src/main/java/org/sonar/core/profiling/StopWatch.java b/sonar-core/src/main/java/org/sonar/core/profiling/StopWatch.java index 2c2b613811d..cd9ca655bb5 100644 --- a/sonar-core/src/main/java/org/sonar/core/profiling/StopWatch.java +++ b/sonar-core/src/main/java/org/sonar/core/profiling/StopWatch.java @@ -19,7 +19,10 @@ */ package org.sonar.core.profiling; -public abstract class StopWatch { +public interface StopWatch { - public abstract void stop(String message, Object... args); + /** + * Stop the watch and print provided profiling message + */ + void stop(String message, Object... args); } 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 { @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(""); - return true; + if (code.getColumnPosition() == 0 && quotedLineElement.consume(code, output)) { + while (endOfLine.consume(code, output) && quotedLineElement.consume(code, output)) { + // consume input } + output.append(""); + return true; } return false; } finally { @@ -79,15 +77,18 @@ class HtmlBlockquoteChannel extends Channel { } 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; }