Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
[FIXED JENKINS-37975] Detect JavaDoc errors in 1.8 format.
  • Loading branch information
uhafner committed Jan 3, 2017
1 parent 752f99e commit 01a54cc79a4a52627e1c850b9f1450cbfe2bd97d
@@ -15,7 +15,7 @@
@Extension
public class JavaDocParser extends RegexpLineParser {
private static final long serialVersionUID = 7127568148333474921L;
private static final String JAVA_DOC_WARNING_PATTERN = "(?:\\s*\\[(?:javadoc|WARNING)\\]\\s*)?(?:(?:(.*):(\\d+))|(?:\\s*javadoc\\s*)):\\s*(warning|error)\\s*[-:]\\s*(.*)";
private static final String JAVA_DOC_WARNING_PATTERN = "(?:\\s*\\[(?:javadoc|WARNING|ERROR)\\]\\s*)?(?:(?:(.*):(\\d+))|(?:\\s*javadoc\\s*)):\\s*(warning|error)\\s*[-:]\\s*(.*)";

/**
* Creates a new instance of {@link JavaDocParser}.
@@ -29,7 +29,7 @@ public JavaDocParser() {

@Override
protected boolean isLineInteresting(final String line) {
return line.contains("javadoc") || line.contains("@");
return line.contains("javadoc") || line.contains("@") || (line.contains("error") && line.contains("ERROR"));
}

@Override
@@ -31,10 +31,23 @@ public void falseJavaDocPositives() throws IOException {
}

/**
* Parses a warning log with JavaDoc 1.8 warnings.
* Parses a warning log with JavaDoc 1.8 errors.
*
* @throws IOException
* if the file could not be read
* @see <a href="http://issues.jenkins-ci.org/browse/JENKINS-37975">Issue 37975</a>
*/
@Test
public void issue37975() throws IOException {
Collection<FileAnnotation> warnings = new JavaDocParser().parse(openFile("issue37975.txt"));

assertEquals(WRONG_NUMBER_OF_WARNINGS_DETECTED, 3, warnings.size());
}

/**
* Parses a warning log with JavaDoc 1.8 warnings.
*
* @throws IOException if the file could not be read
* @see <a href="http://issues.jenkins-ci.org/browse/JENKINS-32298">Issue 32298</a>
*/
@Test
@@ -0,0 +1,17 @@
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.451 s
[INFO] Finished at: 2016-09-06T09:36:28+02:00
[INFO] Final Memory: 37M/534M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.10.4:jar (attach-javadocs) on project cache2k-api: MavenReportException: Error while generating Javadoc:
[ERROR] Exit code: 1 - /home/jeans/ideaWork/cache2k-internal/cache2k/api/src/main/java/org/cache2k/processor/MutableCacheEntry.java:79: error: malformed HTML
[ERROR] * @see <a href="https://github.com/jsr107/jsr107tck/issues/84>JSR107 TCK issue 84</a>
[ERROR] ^
[ERROR] /home/jeans/ideaWork/cache2k-internal/cache2k/api/src/main/java/org/cache2k/processor/MutableCacheEntry.java:79: error: bad use of '>'
[ERROR] * @see <a href="https://github.com/jsr107/jsr107tck/issues/84>JSR107 TCK issue 84</a>
[ERROR] ^
[ERROR] /home/jeans/ideaWork/cache2k-internal/cache2k/api/src/main/java/org/cache2k/processor/MutableCacheEntry.java:79: error: unexpected end tag: </a>
[ERROR] * @see <a href="https://github.com/jsr107/jsr107tck/issues/84>JSR107 TCK issue 84</a>
[ERROR] ^

0 comments on commit 01a54cc

Please sign in to comment.