You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2020/12/24 17:56:35 UTC

[pulsar] branch master updated: Add spotbug checks for pulsar-client-api module (#9033)

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

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new b001283  Add spotbug checks for pulsar-client-api module (#9033)
b001283 is described below

commit b0012835944c0bd0702236b8e9a9d28540088dfc
Author: Yunze Xu <xy...@163.com>
AuthorDate: Thu Dec 24 11:56:14 2020 -0600

    Add spotbug checks for pulsar-client-api module (#9033)
    
    ### Motivation
    
    Add spotbugs plugin for pulsar-client-api module.
    
    ### Modifications
    
    The most potential bugs are related to the raw array's getter/setter/constructor and the rest one is just a default method of an interface, so we just ignore these spotbugs.
---
 pulsar-client-api/pom.xml                          | 12 ++++++
 .../src/main/resources/findbugsExclude.xml         | 50 ++++++++++++++++++++++
 2 files changed, 62 insertions(+)

diff --git a/pulsar-client-api/pom.xml b/pulsar-client-api/pom.xml
index d13fcb6..2936bfc 100644
--- a/pulsar-client-api/pom.xml
+++ b/pulsar-client-api/pom.xml
@@ -46,5 +46,17 @@
     </dependencies>
 
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>com.github.spotbugs</groupId>
+                <artifactId>spotbugs-maven-plugin</artifactId>
+                <version>${spotbugs-maven-plugin.version}</version>
+                <configuration>
+                    <excludeFilterFile>${basedir}/src/main/resources/findbugsExclude.xml</excludeFilterFile>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 
 </project>
diff --git a/pulsar-client-api/src/main/resources/findbugsExclude.xml b/pulsar-client-api/src/main/resources/findbugsExclude.xml
new file mode 100644
index 0000000..9d73ac2
--- /dev/null
+++ b/pulsar-client-api/src/main/resources/findbugsExclude.xml
@@ -0,0 +1,50 @@
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<FindBugsFilter>
+  <!-- Ignore the array access related expose bugs -->
+  <Match>
+    <Class name="org.apache.pulsar.client.api.EncryptionKeyInfo"/>
+    <Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2"/>
+  </Match>
+  <Match>
+    <Class name="org.apache.pulsar.common.api.EncryptionContext$EncryptionKey"/>
+    <Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2"/>
+  </Match>
+  <Match>
+    <Class name="org.apache.pulsar.common.schema.SchemaInfo"/>
+    <Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2"/>
+  </Match>
+  <Match>
+    <Class name="org.apache.pulsar.common.schema.SchemaInfo$SchemaInfoBuilder"/>
+    <Bug pattern="EI_EXPOSE_REP2"/>
+  </Match>
+
+  <Match>
+    <Class name="org.apache.pulsar.common.api.AuthData"/>
+    <Bug pattern="EI_EXPOSE_REP"/>
+  </Match>
+
+  <!-- The implementation of Schema#encode may have side effect so the return value can be ignored -->
+  <Match>
+    <Class name="org.apache.pulsar.client.api.Schema"/>
+    <Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/>
+  </Match>
+</FindBugsFilter>
\ No newline at end of file