You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/12/21 10:00:07 UTC

[GitHub] [pulsar] zymap opened a new pull request #9016: Enable spotbugs check in the module pulsar-common

zymap opened a new pull request #9016:
URL: https://github.com/apache/pulsar/pull/9016


   ---
   
   *Motivation*
   
   Enable spotbugs check in the module pulsar-common.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui commented on pull request #9016: Enable spotbugs check in the module pulsar-common

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on pull request #9016:
URL: https://github.com/apache/pulsar/pull/9016#issuecomment-749906754


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] zymap commented on pull request #9016: Enable spotbugs check in the module pulsar-common

Posted by GitBox <gi...@apache.org>.
zymap commented on pull request #9016:
URL: https://github.com/apache/pulsar/pull/9016#issuecomment-753615893


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] zymap commented on pull request #9016: Enable spotbugs check in the module pulsar-common

Posted by GitBox <gi...@apache.org>.
zymap commented on pull request #9016:
URL: https://github.com/apache/pulsar/pull/9016#issuecomment-749283794


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui merged pull request #9016: Enable spotbugs check in the module pulsar-common

Posted by GitBox <gi...@apache.org>.
codelipenghui merged pull request #9016:
URL: https://github.com/apache/pulsar/pull/9016


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] zymap commented on a change in pull request #9016: Enable spotbugs check in the module pulsar-common

Posted by GitBox <gi...@apache.org>.
zymap commented on a change in pull request #9016:
URL: https://github.com/apache/pulsar/pull/9016#discussion_r548419089



##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/Policies.java
##########
@@ -241,18 +241,16 @@ public String toString() {
     }
 
 
-    private static final long MAX_BUNDLES = ((long) 1) << 32;
-
     public static BundlesData getBundles(int numBundles) {
-        if (numBundles <= 0 || numBundles > MAX_BUNDLES) {
+        if (numBundles <= 0) {

Review comment:
       Please take a look at this change. I am not sure why we used the long value before.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] sijie commented on a change in pull request #9016: Enable spotbugs check in the module pulsar-common

Posted by GitBox <gi...@apache.org>.
sijie commented on a change in pull request #9016:
URL: https://github.com/apache/pulsar/pull/9016#discussion_r549630618



##########
File path: pulsar-common/src/main/resources/findbugsExclude.xml
##########
@@ -0,0 +1,81 @@
+<!--
+
+    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>
+    <Match>
+        <Class name="org.apache.pulsar.PulsarVersion"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.shaded\.com\.google\.protobuf.*"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.common\.api\.proto.*"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.nar.FileUtils"/>
+        <Method name="deleteFilesInDirectory"/>
+        <Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.policies.data.FunctionStats$FunctionInstanceStats$FunctionInstanceStatsData"/>
+        <Bug pattern="EQ_OVERRIDING_EQUALS_NOT_SYMMETRIC"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.util.collections.ConcurrentBitSet"/>
+        <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.util.collections.ConcurrentBitSetRecyclable"/>
+        <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.util.NamespaceBundleStatsComparator"/>
+        <Bug pattern="SE_COMPARATOR_SHOULD_BE_SERIALIZABLE"/>
+    </Match>
+
+    <Match>

Review comment:
       Sure. Can you create a follow-up issue and add a comment with the issue link to the file?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] zymap commented on a change in pull request #9016: Enable spotbugs check in the module pulsar-common

Posted by GitBox <gi...@apache.org>.
zymap commented on a change in pull request #9016:
URL: https://github.com/apache/pulsar/pull/9016#discussion_r548418620



##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/nar/NarClassLoader.java
##########
@@ -151,11 +158,13 @@ public static NarClassLoader getFromArchive(File narPath, Set<String> additional
                                                 String narExtractionDirectory)
         throws IOException {
         File unpacked = NarUnpacker.unpackNar(narPath, getNarExtractionDirectory(narExtractionDirectory));
-        try {
-            return new NarClassLoader(unpacked, additionalJars, parent);
-        } catch (ClassNotFoundException | NoClassDefFoundError e) {
-            throw new IOException(e);
-        }
+        return AccessController.doPrivileged(new PrivilegedAction<NarClassLoader>() {

Review comment:
       Is this right?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] zymap commented on a change in pull request #9016: Enable spotbugs check in the module pulsar-common

Posted by GitBox <gi...@apache.org>.
zymap commented on a change in pull request #9016:
URL: https://github.com/apache/pulsar/pull/9016#discussion_r548875240



##########
File path: pulsar-common/src/main/resources/findbugsExclude.xml
##########
@@ -0,0 +1,81 @@
+<!--
+
+    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>
+    <Match>
+        <Class name="org.apache.pulsar.PulsarVersion"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.shaded\.com\.google\.protobuf.*"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.common\.api\.proto.*"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.nar.FileUtils"/>
+        <Method name="deleteFilesInDirectory"/>
+        <Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.policies.data.FunctionStats$FunctionInstanceStats$FunctionInstanceStatsData"/>
+        <Bug pattern="EQ_OVERRIDING_EQUALS_NOT_SYMMETRIC"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.util.collections.ConcurrentBitSet"/>
+        <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.util.collections.ConcurrentBitSetRecyclable"/>
+        <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.util.NamespaceBundleStatsComparator"/>
+        <Bug pattern="SE_COMPARATOR_SHOULD_BE_SERIALIZABLE"/>
+    </Match>
+
+    <Match>

Review comment:
       There are some error will change a lot of classes file, for example, the `URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD`, most of this error is found in the stats classes. We have a lot of classes that use the stats class so it will change across multiple files. Can I create an issue for that and use other PRs for fixing it?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] sijie commented on a change in pull request #9016: Enable spotbugs check in the module pulsar-common

Posted by GitBox <gi...@apache.org>.
sijie commented on a change in pull request #9016:
URL: https://github.com/apache/pulsar/pull/9016#discussion_r548424243



##########
File path: pulsar-common/src/main/resources/findbugsExclude.xml
##########
@@ -0,0 +1,81 @@
+<!--
+
+    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>
+    <Match>
+        <Class name="org.apache.pulsar.PulsarVersion"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.shaded\.com\.google\.protobuf.*"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.common\.api\.proto.*"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.nar.FileUtils"/>
+        <Method name="deleteFilesInDirectory"/>
+        <Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.policies.data.FunctionStats$FunctionInstanceStats$FunctionInstanceStatsData"/>
+        <Bug pattern="EQ_OVERRIDING_EQUALS_NOT_SYMMETRIC"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.util.collections.ConcurrentBitSet"/>
+        <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.util.collections.ConcurrentBitSetRecyclable"/>
+        <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.util.NamespaceBundleStatsComparator"/>
+        <Bug pattern="SE_COMPARATOR_SHOULD_BE_SERIALIZABLE"/>
+    </Match>
+
+    <Match>

Review comment:
       Why do we exclude the following bugs? At a minimum, we should only exclude those bugs for a specific class if we have a clear idea that we should exclude them.

##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/Policies.java
##########
@@ -241,18 +241,16 @@ public String toString() {
     }
 
 
-    private static final long MAX_BUNDLES = ((long) 1) << 32;
-
     public static BundlesData getBundles(int numBundles) {
-        if (numBundles <= 0 || numBundles > MAX_BUNDLES) {
+        if (numBundles <= 0) {

Review comment:
       I don't think the change is correct. What was the findbugs error here?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] zymap commented on pull request #9016: Enable spotbugs check in the module pulsar-common

Posted by GitBox <gi...@apache.org>.
zymap commented on pull request #9016:
URL: https://github.com/apache/pulsar/pull/9016#issuecomment-752083323


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] zymap commented on a change in pull request #9016: Enable spotbugs check in the module pulsar-common

Posted by GitBox <gi...@apache.org>.
zymap commented on a change in pull request #9016:
URL: https://github.com/apache/pulsar/pull/9016#discussion_r549258299



##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/Policies.java
##########
@@ -241,18 +241,16 @@ public String toString() {
     }
 
 
-    private static final long MAX_BUNDLES = ((long) 1) << 32;
-
     public static BundlesData getBundles(int numBundles) {
-        if (numBundles <= 0 || numBundles > MAX_BUNDLES) {
+        if (numBundles <= 0) {

Review comment:
       It should be only affected by the comparison of the values. I remove the comparison between the int value and long value. 
   But I still wonder why we use a 'long' to represent the max size of the bundles? 

##########
File path: pulsar-common/src/main/resources/findbugsExclude.xml
##########
@@ -0,0 +1,81 @@
+<!--
+
+    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>
+    <Match>
+        <Class name="org.apache.pulsar.PulsarVersion"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.shaded\.com\.google\.protobuf.*"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.common\.api\.proto.*"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.nar.FileUtils"/>
+        <Method name="deleteFilesInDirectory"/>
+        <Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.policies.data.FunctionStats$FunctionInstanceStats$FunctionInstanceStatsData"/>
+        <Bug pattern="EQ_OVERRIDING_EQUALS_NOT_SYMMETRIC"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.util.collections.ConcurrentBitSet"/>
+        <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.util.collections.ConcurrentBitSetRecyclable"/>
+        <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.util.NamespaceBundleStatsComparator"/>
+        <Bug pattern="SE_COMPARATOR_SHOULD_BE_SERIALIZABLE"/>
+    </Match>
+
+    <Match>

Review comment:
       I clean most of the bugs. But there has still some bugs marked excluded by me. Because it will cause almost 130 bugs and it will need to change a lot of files across different modules. 
   Can I fix them in other PRs?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] zymap commented on pull request #9016: Enable spotbugs check in the module pulsar-common

Posted by GitBox <gi...@apache.org>.
zymap commented on pull request #9016:
URL: https://github.com/apache/pulsar/pull/9016#issuecomment-749354320


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] zymap commented on pull request #9016: Enable spotbugs check in the module pulsar-common

Posted by GitBox <gi...@apache.org>.
zymap commented on pull request #9016:
URL: https://github.com/apache/pulsar/pull/9016#issuecomment-750302875


   /pulsarbot run-failure-checks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] sijie commented on a change in pull request #9016: Enable spotbugs check in the module pulsar-common

Posted by GitBox <gi...@apache.org>.
sijie commented on a change in pull request #9016:
URL: https://github.com/apache/pulsar/pull/9016#discussion_r548191499



##########
File path: pulsar-common/src/main/resources/findbugsExclude.xml
##########
@@ -0,0 +1,126 @@
+<!--
+
+    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>
+    <Match>
+        <Class name="org.apache.pulsar.PulsarVersion"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.shaded\.com\.google\.protobuf.*"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.common\.api\.proto.*"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.api.raw.RawMessageImpl"/>
+        <Method name="getKeyBytes"/>
+        <Bug pattern="DM_DEFAULT_ENCODING"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.policies.data.loadbalancer.ResourceUsage"/>
+        <Method name="compareTo"/>
+        <Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS"/>

Review comment:
       I think we need to fix the bugs introduced by this.

##########
File path: pulsar-common/src/main/resources/findbugsExclude.xml
##########
@@ -0,0 +1,126 @@
+<!--
+
+    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>
+    <Match>
+        <Class name="org.apache.pulsar.PulsarVersion"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.shaded\.com\.google\.protobuf.*"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.common\.api\.proto.*"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.api.raw.RawMessageImpl"/>
+        <Method name="getKeyBytes"/>
+        <Bug pattern="DM_DEFAULT_ENCODING"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.policies.data.loadbalancer.ResourceUsage"/>
+        <Method name="compareTo"/>
+        <Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.nar.FileUtils"/>
+        <Method name="deleteFilesInDirectory"/>
+        <Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.nar.NarClassLoader"/>
+        <Method name="getServiceImplementation"/>
+        <Bug pattern="DM_DEFAULT_ENCODING"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.policies.data.Policies"/>
+        <Method name="getBundles"/>
+        <Bug pattern="INT_BAD_COMPARISON_WITH_INT_VALUE"/>

Review comment:
       I think we need to fix the bugs introduced by this.

##########
File path: pulsar-common/src/main/resources/findbugsExclude.xml
##########
@@ -0,0 +1,126 @@
+<!--
+
+    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>
+    <Match>
+        <Class name="org.apache.pulsar.PulsarVersion"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.shaded\.com\.google\.protobuf.*"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.common\.api\.proto.*"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.api.raw.RawMessageImpl"/>
+        <Method name="getKeyBytes"/>
+        <Bug pattern="DM_DEFAULT_ENCODING"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.policies.data.loadbalancer.ResourceUsage"/>
+        <Method name="compareTo"/>
+        <Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.nar.FileUtils"/>
+        <Method name="deleteFilesInDirectory"/>
+        <Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.nar.NarClassLoader"/>
+        <Method name="getServiceImplementation"/>
+        <Bug pattern="DM_DEFAULT_ENCODING"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.policies.data.Policies"/>
+        <Method name="getBundles"/>
+        <Bug pattern="INT_BAD_COMPARISON_WITH_INT_VALUE"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.nar.NarClassLoader"/>
+        <Method name="getFromArchive"/>
+        <Bug pattern="DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED"/>

Review comment:
       I think we need to fix the bugs introduced by this.

##########
File path: pulsar-common/src/main/resources/findbugsExclude.xml
##########
@@ -0,0 +1,126 @@
+<!--
+
+    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>
+    <Match>
+        <Class name="org.apache.pulsar.PulsarVersion"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.shaded\.com\.google\.protobuf.*"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.common\.api\.proto.*"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.api.raw.RawMessageImpl"/>
+        <Method name="getKeyBytes"/>
+        <Bug pattern="DM_DEFAULT_ENCODING"/>

Review comment:
       I think we need to fix the bugs introduced by this.

##########
File path: pulsar-common/src/main/resources/findbugsExclude.xml
##########
@@ -0,0 +1,126 @@
+<!--
+
+    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>
+    <Match>
+        <Class name="org.apache.pulsar.PulsarVersion"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.shaded\.com\.google\.protobuf.*"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.common\.api\.proto.*"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.api.raw.RawMessageImpl"/>
+        <Method name="getKeyBytes"/>
+        <Bug pattern="DM_DEFAULT_ENCODING"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.policies.data.loadbalancer.ResourceUsage"/>
+        <Method name="compareTo"/>
+        <Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.nar.FileUtils"/>
+        <Method name="deleteFilesInDirectory"/>
+        <Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.nar.NarClassLoader"/>
+        <Method name="getServiceImplementation"/>
+        <Bug pattern="DM_DEFAULT_ENCODING"/>

Review comment:
       I think we need to fix the bugs introduced by this.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] zymap commented on a change in pull request #9016: Enable spotbugs check in the module pulsar-common

Posted by GitBox <gi...@apache.org>.
zymap commented on a change in pull request #9016:
URL: https://github.com/apache/pulsar/pull/9016#discussion_r549640073



##########
File path: pulsar-common/src/main/resources/findbugsExclude.xml
##########
@@ -0,0 +1,81 @@
+<!--
+
+    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>
+    <Match>
+        <Class name="org.apache.pulsar.PulsarVersion"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.shaded\.com\.google\.protobuf.*"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.common\.api\.proto.*"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.nar.FileUtils"/>
+        <Method name="deleteFilesInDirectory"/>
+        <Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.policies.data.FunctionStats$FunctionInstanceStats$FunctionInstanceStatsData"/>
+        <Bug pattern="EQ_OVERRIDING_EQUALS_NOT_SYMMETRIC"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.util.collections.ConcurrentBitSet"/>
+        <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.util.collections.ConcurrentBitSetRecyclable"/>
+        <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.util.NamespaceBundleStatsComparator"/>
+        <Bug pattern="SE_COMPARATOR_SHOULD_BE_SERIALIZABLE"/>
+    </Match>
+
+    <Match>

Review comment:
       issue created #9080 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] zymap commented on a change in pull request #9016: Enable spotbugs check in the module pulsar-common

Posted by GitBox <gi...@apache.org>.
zymap commented on a change in pull request #9016:
URL: https://github.com/apache/pulsar/pull/9016#discussion_r548875240



##########
File path: pulsar-common/src/main/resources/findbugsExclude.xml
##########
@@ -0,0 +1,81 @@
+<!--
+
+    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>
+    <Match>
+        <Class name="org.apache.pulsar.PulsarVersion"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.shaded\.com\.google\.protobuf.*"/>
+    </Match>
+
+    <Match>
+        <Class name="~org\.apache\.pulsar\.common\.api\.proto.*"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.nar.FileUtils"/>
+        <Method name="deleteFilesInDirectory"/>
+        <Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.policies.data.FunctionStats$FunctionInstanceStats$FunctionInstanceStatsData"/>
+        <Bug pattern="EQ_OVERRIDING_EQUALS_NOT_SYMMETRIC"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.util.collections.ConcurrentBitSet"/>
+        <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.util.collections.ConcurrentBitSetRecyclable"/>
+        <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
+    </Match>
+
+    <Match>
+        <Class name="org.apache.pulsar.common.util.NamespaceBundleStatsComparator"/>
+        <Bug pattern="SE_COMPARATOR_SHOULD_BE_SERIALIZABLE"/>
+    </Match>
+
+    <Match>

Review comment:
       There are some error will change a lot of classes file, for example, the `URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD`, most of this error is found in the stats classes. We have a lot of classes that use the stats class so it will change across multiple files. Can I create an issue for that and use other PRs for fixing it?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] zymap commented on a change in pull request #9016: Enable spotbugs check in the module pulsar-common

Posted by GitBox <gi...@apache.org>.
zymap commented on a change in pull request #9016:
URL: https://github.com/apache/pulsar/pull/9016#discussion_r548501750



##########
File path: pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/Policies.java
##########
@@ -241,18 +241,16 @@ public String toString() {
     }
 
 
-    private static final long MAX_BUNDLES = ((long) 1) << 32;
-
     public static BundlesData getBundles(int numBundles) {
-        if (numBundles <= 0 || numBundles > MAX_BUNDLES) {
+        if (numBundles <= 0) {

Review comment:
       The findbugs error is: INT_BAD_COMPARISON_WITH_INT_VALUE




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org