This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-email.git


The following commit(s) were added to refs/heads/master by this push:
     new b278b79  Exclude the specific false positives in Java 11+
b278b79 is described below

commit b278b79d5caf065ec7314479ed39de063cf1eb20
Author: Sebb <s...@apache.org>
AuthorDate: Sat Dec 16 22:52:14 2023 +0000

    Exclude the specific false positives in Java 11+
    
    rather than allowing for a few to occur
---
 pom.xml                              | 24 ------------------------
 src/conf/spotbugs-exclude-filter.xml | 17 +++++++++++++++++
 2 files changed, 17 insertions(+), 24 deletions(-)

diff --git a/pom.xml b/pom.xml
index 541d2a4..04c5ac9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -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. -->
diff --git a/src/conf/spotbugs-exclude-filter.xml 
b/src/conf/spotbugs-exclude-filter.xml
index ee893be..a80aea6 100644
--- a/src/conf/spotbugs-exclude-filter.xml
+++ b/src/conf/spotbugs-exclude-filter.xml
@@ -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>

Reply via email to