Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
[FIXED JENKINS-16826] remove blank warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Feb 15, 2013
1 parent 4a694d0 commit cf89edc
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
Expand Up @@ -8,6 +8,8 @@
import java.util.List;
import java.util.regex.Matcher;

import org.apache.commons.lang.StringUtils;

import com.google.common.collect.Lists;

/**
Expand Down Expand Up @@ -71,7 +73,13 @@ protected Collection<FileAnnotation> postProcessWarnings(final List<FileAnnotati
}
line = warning.getPrimaryLineNumber();
}
return condensed;
List<FileAnnotation> noBlank = Lists.newArrayList();
for (FileAnnotation warning : condensed) {
if (StringUtils.isNotBlank(warning.getMessage())) {
noBlank.add(warning);
}
}
return noBlank;
}
}

Expand Up @@ -33,6 +33,20 @@ public void testParsing() throws IOException {
assertEquals("Wrong number of warnings detected.", 2, result.getNumberOfAnnotations(Priority.NORMAL));
}

/**
* Parses a file with three warnings, two of them will be ignored beacuse they are blank.
*
* @throws IOException
* if the file could not be read
* @see <a href="http://issues.jenkins-ci.org/browse/JENKINS-16826">Issue 16826</a>
*/
@Test
public void issue16826() throws IOException {
Collection<FileAnnotation> warnings = new MavenConsoleParser().parse(openFile("issue16826.txt"));

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

@Override
protected String getWarningsFile() {
return "maven-console.txt";
Expand Down
@@ -0,0 +1,6 @@
[WARNING] bootstrap class path not set in conjunction with -source 1.6
/home/jan/.jenkins/jobs/Static_code_analysis/workspace/common/src/main/java/com/noesis/optimus/model/SerializedArray.java:[126,53] [unchecked] unchecked cast
[WARNING]
T extends Object declared in class SerializedArray
/home/jan/.jenkins/jobs/Static_code_analysis/workspace/common/src/main/java/com/noesis/optimus/model/LongIdEntity.java:[147,37] [unchecked] unchecked cast
[WARNING]

0 comments on commit cf89edc

Please sign in to comment.