diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.java index 73deacb1d..e3ba991d2 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.java @@ -209,7 +209,7 @@ class TagParser to = findChar(aText, '>', to); while ((to.getLineNo() < aText.length) && !aText[to.getLineNo()] - .substring(0, to.getColumnNo()).endsWith("-->")) + .substring(0, to.getColumnNo() + 1).endsWith("-->")) { to = findChar(aText, '>', getNextCharPos(aText, to)); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheckTest.java index 482647df3..516a037f6 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheckTest.java @@ -128,6 +128,19 @@ public class JavadocStyleCheckTest verify(checkConfig, getPath("InputJavadocStyleCheck.java"), expected); } + @Test + public void testHtmlComment() throws Exception + { + final DefaultConfiguration checkConfig = createCheckConfig(JavadocStyleCheck.class); + checkConfig.addAttribute("checkFirstSentence", "false"); + checkConfig.addAttribute("checkHtml", "true"); + final String[] expected = + { + }; + + verify(checkConfig, getPath("InputJavadocStyleCheckHtmlComment.java"), expected); + } + @Test public void testScopePublic() throws Exception diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/InputJavadocStyleCheckHtmlComment.java b/src/test/resources/com/puppycrawl/tools/checkstyle/InputJavadocStyleCheckHtmlComment.java new file mode 100644 index 000000000..74b8aa63e --- /dev/null +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/InputJavadocStyleCheckHtmlComment.java @@ -0,0 +1,77 @@ +//////////////////////////////////////////////////////////////////////////////// +// Test case file for checkstyle. +// Created: 2014 +//////////////////////////////////////////////////////////////////////////////// + +package com.puppycrawl.tools.checkstyle; + +/** + * Test input for the JavadocStyleCheck. This check is used to perform + * some additional Javadoc validations. + * + * @author Tobias Geyer + * @version 1.0 + */ +public class InputJavadocStyleCheckHtmlComment +{ + /** + * sometimes a tag starts + *
+ * somewhere and has a comment in the middle + * + * and ends afterwards + *+ */ + private void method1() + { // JavadocStyle should not report any error for this method + } + + /** + * sometimes a tag starts + *
+ * somewhere and has a multiline comment in the middle + * + * and ends afterwards + *+ */ + private void method2() + { // JavadocStyle should not report any error for this method + } + + /** + * sometimes a tag starts + *
+ * somewhere and has a multiline comment in the middle + *+ * and ends on the same line + */ + private void method3() + { // JavadocStyle should not report any error for this method + } + + /** + * sometimes a tag starts + *
+ * somewhere and has a comment in the middle + * with text following + * and ends afterwards + *+ */ + private void method4() + { // JavadocStyle should not report any error for this method + } + + /** + * sometimes a tag starts + * + * and ends with a comment in the middle + */ + private void method5() + { // JavadocStyle should not report any error for this method + } + +}