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

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


The following commit(s) were added to refs/heads/master by this push:
     new 63e5740eb6a Add fb-contrib and findsecbugs for SpotBugs (#24930)
63e5740eb6a is described below

commit 63e5740eb6a246827fc558fd718fb8c64b1062e4
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Apr 1 06:41:39 2023 +0800

    Add fb-contrib and findsecbugs for SpotBugs (#24930)
---
 .../agent/core/advisor/executor/AdviceExecutorFactory.java |  2 +-
 .../agent/core/classloader/AgentExtraClassLoader.java      |  2 +-
 pom.xml                                                    | 14 ++++++++++++++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/AdviceExecutorFactory.java
 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/AdviceExecutorFactory.java
index cceed737468..237fcd6fd47 100644
--- 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/AdviceExecutorFactory.java
+++ 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/AdviceExecutorFactory.java
@@ -87,7 +87,7 @@ public final class AdviceExecutorFactory {
     
     @SuppressWarnings("unchecked")
     private <T extends AgentAdvice> Map<String, Collection<T>> convert(final 
Map<String, Collection<AgentAdvice>> advices) {
-        Map<String, Collection<T>> result = new HashMap<>();
+        Map<String, Collection<T>> result = new HashMap<>(advices.size(), 1);
         for (Entry<String, Collection<AgentAdvice>> entry : 
advices.entrySet()) {
             result.put(entry.getKey(), new LinkedList<>());
             for (AgentAdvice each : entry.getValue()) {
diff --git 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/classloader/AgentExtraClassLoader.java
 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/classloader/AgentExtraClassLoader.java
index c6367f8f680..1ee11e03dd1 100644
--- 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/classloader/AgentExtraClassLoader.java
+++ 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/classloader/AgentExtraClassLoader.java
@@ -70,7 +70,7 @@ public abstract class AgentExtraClassLoader extends 
ClassLoader {
                 definePackage(name, each);
                 return defineClass(name, each, entry);
             } catch (final IOException ex) {
-                throw new ClassNotFoundException(name);
+                throw new ClassNotFoundException(name, ex);
             }
         }
         throw new ClassNotFoundException(name);
diff --git a/pom.xml b/pom.xml
index 75f397acefa..1a1255398e9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -137,6 +137,8 @@
         <jacoco-maven-plugin.version>0.8.8</jacoco-maven-plugin.version>
         
<maven-checkstyle-plugin.version>3.2.1</maven-checkstyle-plugin.version>
         <spotbugs-maven-plugin.version>4.7.2.1</spotbugs-maven-plugin.version>
+        <fb-contrib.version>7.6.0</fb-contrib.version>
+        <findsecbugs.version>1.12.0</findsecbugs.version>
         <maven-pmd-plugin.version>3.5</maven-pmd-plugin.version>
         <jdepend-maven-plugin.version>2.0</jdepend-maven-plugin.version>
         <taglist-maven-plugin.version>2.4</taglist-maven-plugin.version>
@@ -1077,6 +1079,18 @@
                 <version>${spotbugs-maven-plugin.version}</version>
                 <configuration>
                     
<excludeFilterFile>src/resources/spotbugs.xml</excludeFilterFile>
+                    <plugins>
+                        <plugin>
+                            <groupId>com.mebigfatguy.fb-contrib</groupId>
+                            <artifactId>fb-contrib</artifactId>
+                            <version>${fb-contrib.version}</version>
+                        </plugin>
+                        <plugin>
+                            <groupId>com.h3xstream.findsecbugs</groupId>
+                            <artifactId>findsecbugs-plugin</artifactId>
+                            <version>${findsecbugs.version}</version>
+                        </plugin>
+                    </plugins>
                 </configuration>
             </plugin>
             <plugin>

Reply via email to