Skip to content

Commit

Permalink
Exclude the specific false positives in Java 11+
Browse files Browse the repository at this point in the history
rather than allowing for a few to occur
  • Loading branch information
sebbASF committed Dec 16, 2023
1 parent 974ea6b commit b278b79
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
24 changes: 0 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -482,30 +482,6 @@
</reporting>

<profiles>
<profile>
<id>java11</id>
<!-- For testing with Powermock. -->
<activation>
<jdk>[11,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<!-- SpotBugs has false positives on Java 17:
[ERROR] Medium: Load of known null value in org.apache.commons.mail.MultiPartEmail.attach(DataSource, String, String) [org.apache.commons.mail.MultiPartEmail] At MultiPartEmail.java:[line 421] NP_LOAD_OF_KNOWN_NULL_VALUE
[ERROR] Medium: Redundant nullcheck of is which is known to be null in org.apache.commons.mail.MultiPartEmail.attach(DataSource, String, String) [org.apache.commons.mail.MultiPartEmail] Redundant null check at MultiPartEmail.java:[line 421] RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE
[ERROR] Medium: Load of known null value in org.apache.commons.mail.resolver.DataSourceClassPathResolver.resolve(String, boolean) [org.apache.commons.mail.resolver.DataSourceClassPathResolver] At DataSourceClassPathResolver.java:[line 104] NP_LOAD_OF_KNOWN_NULL_VALUE
[ERROR] Medium: Redundant nullcheck of is which is known to be null in org.apache.commons.mail.resolver.DataSourceClassPathResolver.resolve(String, boolean) [org.apache.commons.mail.resolver.DataSourceClassPathResolver] Redundant null check at DataSourceClassPathResolver.java:[line 104] RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE
-->
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<configuration>
<maxAllowedViolations>4</maxAllowedViolations>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>java17</id>
<!-- For testing with Powermock. -->
Expand Down
17 changes: 17 additions & 0 deletions src/conf/spotbugs-exclude-filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,21 @@
</Or>
</Match>

<!-- False positives in Java 11+
Error: Load of known null value in org.apache.commons.mail.resolver.DataSourceClassPathResolver.resolve(String, boolean)
[org.apache.commons.mail.resolver.DataSourceClassPathResolver]
At DataSourceClassPathResolver.java:[line 115] NP_LOAD_OF_KNOWN_NULL_VALUE
Error: Redundant nullcheck of inputStream which is known to be null in org.apache.commons.mail.resolver.DataSourceClassPathResolver.resolve(String, boolean)
[org.apache.commons.mail.resolver.DataSourceClassPathResolver]
Redundant null check at DataSourceClassPathResolver.java:[line 115] RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE
-->
<Match>
<Class name="org.apache.commons.mail.resolver.DataSourceClassPathResolver" />
<Method name="resolve" params="java.lang.String, boolean" returns="javax.activation.DataSource"/>
<Or>
<Bug pattern="NP_LOAD_OF_KNOWN_NULL_VALUE" />
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE" />
</Or>
</Match>

</FindBugsFilter>

0 comments on commit b278b79

Please sign in to comment.