}
private void mapRulePriority(Map<String, RulePriority> prioritiesByRule, RulePriority priority, String key) {
- if (prioritiesByRule.containsKey(key)) {
+ if (prioritiesByRule.containsKey(key) && prioritiesByRule.get(key) != null) {
if (prioritiesByRule.get(key).compareTo(priority) < 0) {
prioritiesByRule.put(key, priority);
}
assertThat(results.size(), is(0));
assertThat(messages.getErrors().size(), is(1));
}
-
+
@Test
public void testImportingXmlFileWithUnknownRule() throws IOException {
String uncorrectFindbugsXml = TestUtils.getResourceContent("/org/sonar/plugins/findbugs/findbugsXmlWithUnknownRule.xml");
assertThat(results.size(), is(1));
assertThat(messages.getWarnings().size(), is(1));
}
-
+
@Test
public void testImportingXmlFileWithUnknownCategory() throws IOException {
String uncorrectFindbugsXml = TestUtils.getResourceContent("/org/sonar/plugins/findbugs/findbugsXmlWithUnknownCategory.xml");
assertThat(results.size(), is(142));
assertThat(messages.getWarnings().size(), is(1));
}
-
+
@Test
public void testImportingXmlFileWithUnknownCode() throws IOException {
String uncorrectFindbugsXml = TestUtils.getResourceContent("/org/sonar/plugins/findbugs/findbugsXmlWithUnknownCode.xml");
<FindBugsFilter>
- <Match>
- <Or>
- <Bug pattern="NP_CLOSING_NULL"/>
- <Bug pattern="RC_REF_COMPARISON_BAD_PRACTICE"/>
- </Or>
- <Priority value="2"/>
- </Match>
+ <Match>
+ <Bug pattern="NP_CLOSING_NULL" />
+ </Match>
+ <Match>
+ <Bug pattern="RC_REF_COMPARISON_BAD_PRACTICE" />
+ </Match>
+ <Match>
+ <Bug pattern="RC_REF_COMPARISON_BAD_PRACTICE" />
+ </Match>
</FindBugsFilter>
\ No newline at end of file