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

duanzhengqiang 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 61b03e622b5 Fix sonar issue of ConstructorAdviceExecutor (#25893)
61b03e622b5 is described below

commit 61b03e622b51dff37b96e6350f95eb3f14415210
Author: Liang Zhang <[email protected]>
AuthorDate: Thu May 25 19:39:28 2023 +0800

    Fix sonar issue of ConstructorAdviceExecutor (#25893)
---
 .../core/advisor/executor/type/ConstructorAdviceExecutor.java | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/ConstructorAdviceExecutor.java
 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/ConstructorAdviceExecutor.java
index 5752eeb7c30..3d04236a2d0 100644
--- 
a/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/ConstructorAdviceExecutor.java
+++ 
b/agent/core/src/main/java/org/apache/shardingsphere/agent/core/advisor/executor/type/ConstructorAdviceExecutor.java
@@ -56,12 +56,13 @@ public final class ConstructorAdviceExecutor implements 
AdviceExecutor {
     @RuntimeType
     public void advice(@This final TargetAdviceObject target, @AllArguments 
final Object[] args) {
         boolean adviceEnabled = PluginContext.getInstance().isPluginEnabled();
+        if (!adviceEnabled) {
+            return;
+        }
         try {
-            if (adviceEnabled) {
-                for (Entry<String, Collection<ConstructorAdvice>> entry : 
advices.entrySet()) {
-                    for (ConstructorAdvice each : entry.getValue()) {
-                        each.onConstructor(target, args, entry.getKey());
-                    }
+            for (Entry<String, Collection<ConstructorAdvice>> entry : 
advices.entrySet()) {
+                for (ConstructorAdvice each : entry.getValue()) {
+                    each.onConstructor(target, args, entry.getKey());
                 }
             }
             // CHECKSTYLE:OFF

Reply via email to