Skip to content
Permalink
Browse files

[FIXED JENKINS-16826] remove blank warnings.

  • Loading branch information...
uhafner committed Feb 15, 2013
1 parent 4a694d0 commit cf89edc0fdc1c87be157f718a4b265d0045bda67
@@ -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;

/**
@@ -71,7 +73,13 @@ protected Warning createWarning(final Matcher matcher) {
}
line = warning.getPrimaryLineNumber();
}
return condensed;
List<FileAnnotation> noBlank = Lists.newArrayList();
for (FileAnnotation warning : condensed) {
if (StringUtils.isNotBlank(warning.getMessage())) {
noBlank.add(warning);
}
}
return noBlank;
}
}

@@ -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";
@@ -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.
You can’t perform that action at this time.