You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by mi...@apache.org on 2022/09/22 08:47:11 UTC

[incubator-eventmesh] branch master updated: [ISSUE #1364] Fix WebHook module code checkstyle

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

mikexue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git


The following commit(s) were added to refs/heads/master by this push:
     new 97bfa067 [ISSUE #1364] Fix WebHook module code checkstyle
     new 874d0f39 Merge pull request #1366 from githublaohu/webhook-repair5
97bfa067 is described below

commit 97bfa0671405881432e8b3092c93d8d31f4a663d
Author: githublaohu <Ni...@989898>
AuthorDate: Thu Sep 22 14:40:16 2022 +0800

    [ISSUE #1364] Fix WebHook module code checkstyle
---
 .../core/protocol/http/processor/HandlerService.java      |  4 ++--
 eventmesh-webhook/build.gradle                            |  2 +-
 eventmesh-webhook/eventmesh-webhook-admin/build.gradle    |  4 ++--
 .../webhook/admin/AdminWebHookConfigOperationManage.java  |  4 ++--
 .../webhook/admin/NacosWebHookConfigOperation.java        | 15 ++++++---------
 .../eventmesh/webhook/api/WebHookOperationConstant.java   |  4 ++--
 6 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/HandlerService.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/HandlerService.java
index 4222035e..ec920b0f 100644
--- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/HandlerService.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/processor/HandlerService.java
@@ -94,7 +94,7 @@ public class HandlerService {
 
         if (httpProcessorMap.containsKey(path)) {
             throw new RuntimeException(String.format("HandlerService path %s repeat, repeat processor is %s ",
-                    path, httpProcessor.getClass().getSimpleName()));
+                path, httpProcessor.getClass().getSimpleName()));
         }
         ProcessorWrapper processorWrapper = new ProcessorWrapper();
         processorWrapper.threadPoolExecutor = threadPoolExecutor;
@@ -154,7 +154,7 @@ public class HandlerService {
         ctx.writeAndFlush(response).addListener((ChannelFutureListener) f -> {
             if (!f.isSuccess()) {
                 httpLogger.warn("send response to [{}] fail, will close this channel",
-                        RemotingHelper.parseChannelRemoteAddr(f.channel()));
+                    RemotingHelper.parseChannelRemoteAddr(f.channel()));
                 if (isClose) {
                     f.channel().close();
                 }
diff --git a/eventmesh-webhook/build.gradle b/eventmesh-webhook/build.gradle
index 8d8657a4..b461b7c9 100644
--- a/eventmesh-webhook/build.gradle
+++ b/eventmesh-webhook/build.gradle
@@ -25,7 +25,7 @@ task copyEventMeshAdmin(dependsOn: ['jar']) {
             into('../eventmesh-webhook/dist/apps/')
             from project.jar.getArchivePath()
             exclude {
-                "eventmesh-webhook-${version}.jar"                
+                "eventmesh-webhook-${version}.jar"
             }
         }
         copy {
diff --git a/eventmesh-webhook/eventmesh-webhook-admin/build.gradle b/eventmesh-webhook/eventmesh-webhook-admin/build.gradle
index af232747..4b1b2dac 100644
--- a/eventmesh-webhook/eventmesh-webhook-admin/build.gradle
+++ b/eventmesh-webhook/eventmesh-webhook-admin/build.gradle
@@ -18,7 +18,7 @@
 dependencies {
 
     implementation project(":eventmesh-common")
-	implementation project(":eventmesh-webhook:eventmesh-webhook-api")
+    implementation project(":eventmesh-webhook:eventmesh-webhook-api")
 
     implementation 'org.slf4j:slf4j-api'
     implementation "com.alibaba.nacos:nacos-client:2.0.4"
@@ -26,7 +26,7 @@ dependencies {
     implementation "com.fasterxml.jackson.core:jackson-core"
     implementation "com.fasterxml.jackson.core:jackson-annotations"
 
-    testImplementation project(":eventmesh-webhook:eventmesh-webhook-api")   
+    testImplementation project(":eventmesh-webhook:eventmesh-webhook-api")
 
 
 }
diff --git a/eventmesh-webhook/eventmesh-webhook-admin/src/main/java/org/apache/eventmesh/webhook/admin/AdminWebHookConfigOperationManage.java b/eventmesh-webhook/eventmesh-webhook-admin/src/main/java/org/apache/eventmesh/webhook/admin/AdminWebHookConfigOperationManage.java
index 84ecf701..945733e9 100644
--- a/eventmesh-webhook/eventmesh-webhook-admin/src/main/java/org/apache/eventmesh/webhook/admin/AdminWebHookConfigOperationManage.java
+++ b/eventmesh-webhook/eventmesh-webhook-admin/src/main/java/org/apache/eventmesh/webhook/admin/AdminWebHookConfigOperationManage.java
@@ -33,8 +33,6 @@ import org.slf4j.LoggerFactory;
 
 public class AdminWebHookConfigOperationManage {
 
-    public Logger logger = LoggerFactory.getLogger(this.getClass());
-
     private static final Map<String, Class<? extends WebHookConfigOperation>> map = new HashMap<>();
 
     static {
@@ -42,6 +40,8 @@ public class AdminWebHookConfigOperationManage {
         map.put("nacos", NacosWebHookConfigOperation.class);
     }
 
+    public Logger logger = LoggerFactory.getLogger(this.getClass());
+
     private ConfigurationWrapper configurationWrapper;
 
     private WebHookConfigOperation webHookConfigOperation;
diff --git a/eventmesh-webhook/eventmesh-webhook-admin/src/main/java/org/apache/eventmesh/webhook/admin/NacosWebHookConfigOperation.java b/eventmesh-webhook/eventmesh-webhook-admin/src/main/java/org/apache/eventmesh/webhook/admin/NacosWebHookConfigOperation.java
index 33b3ccdb..97953dc1 100644
--- a/eventmesh-webhook/eventmesh-webhook-admin/src/main/java/org/apache/eventmesh/webhook/admin/NacosWebHookConfigOperation.java
+++ b/eventmesh-webhook/eventmesh-webhook-admin/src/main/java/org/apache/eventmesh/webhook/admin/NacosWebHookConfigOperation.java
@@ -22,8 +22,6 @@ import static org.apache.eventmesh.webhook.api.WebHookOperationConstant.GROUP_PR
 import static org.apache.eventmesh.webhook.api.WebHookOperationConstant.MANUFACTURERS_DATA_ID;
 import static org.apache.eventmesh.webhook.api.WebHookOperationConstant.TIMEOUT_MS;
 
-
-
 import org.apache.eventmesh.common.utils.JsonUtils;
 import org.apache.eventmesh.webhook.api.ManufacturerObject;
 import org.apache.eventmesh.webhook.api.WebHookConfig;
@@ -36,7 +34,6 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
 
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -80,7 +77,7 @@ public class NacosWebHookConfigOperation implements WebHookConfigOperation {
                 return 0;
             }
             result = configService.publishConfig(getWebHookConfigDataId(webHookConfig), getManuGroupId(webHookConfig),
-                    JsonUtils.serialize(webHookConfig), ConfigType.JSON.getType());
+                JsonUtils.serialize(webHookConfig), ConfigType.JSON.getType());
         } catch (NacosException e) {
             logger.error("insertWebHookConfig failed", e);
             return 0;
@@ -92,7 +89,7 @@ public class NacosWebHookConfigOperation implements WebHookConfigOperation {
                 manufacturerObject.addManufacturer(manufacturerName);
                 manufacturerObject.getManufacturerEvents(manufacturerName).add(getWebHookConfigDataId(webHookConfig));
                 configService.publishConfig(MANUFACTURERS_DATA_ID, CONSTANTS_WEBHOOK,
-                        JsonUtils.serialize(manufacturerObject), ConfigType.JSON.getType());
+                    JsonUtils.serialize(manufacturerObject), ConfigType.JSON.getType());
             } catch (NacosException e) {
                 logger.error("update manufacturersInfo error", e);
                 //rollback insert
@@ -115,7 +112,7 @@ public class NacosWebHookConfigOperation implements WebHookConfigOperation {
                 return 0;
             }
             result = configService.publishConfig(getWebHookConfigDataId(webHookConfig),
-                    getManuGroupId(webHookConfig), JsonUtils.serialize(webHookConfig), ConfigType.JSON.getType());
+                getManuGroupId(webHookConfig), JsonUtils.serialize(webHookConfig), ConfigType.JSON.getType());
         } catch (NacosException e) {
             logger.error("updateWebHookConfig failed", e);
         }
@@ -136,7 +133,7 @@ public class NacosWebHookConfigOperation implements WebHookConfigOperation {
                 ManufacturerObject manufacturerObject = getManufacturersInfo();
                 manufacturerObject.getManufacturerEvents(manufacturerName).remove(getWebHookConfigDataId(webHookConfig));
                 configService.publishConfig(MANUFACTURERS_DATA_ID, CONSTANTS_WEBHOOK,
-                        JsonUtils.serialize(manufacturerObject), ConfigType.JSON.getType());
+                    JsonUtils.serialize(manufacturerObject), ConfigType.JSON.getType());
             } catch (NacosException e) {
                 logger.error("update manufacturersInfo error", e);
             }
@@ -170,7 +167,7 @@ public class NacosWebHookConfigOperation implements WebHookConfigOperation {
                 // nacos API is not able to get all config, so use foreach
                 for (int i = startIndex; i < endIndex && i < manufacturerEvents.size(); i++) {
                     String content = configService.getConfig(manufacturerEvents.get(i) + DATA_ID_EXTENSION,
-                            getManuGroupId(webHookConfig), TIMEOUT_MS);
+                        getManuGroupId(webHookConfig), TIMEOUT_MS);
                     webHookConfigs.add(JsonUtils.deserialize(content, WebHookConfig.class));
                 }
             }
@@ -201,7 +198,7 @@ public class NacosWebHookConfigOperation implements WebHookConfigOperation {
     private ManufacturerObject getManufacturersInfo() throws NacosException {
         String manufacturersContent = configService.getConfig(MANUFACTURERS_DATA_ID, CONSTANTS_WEBHOOK, TIMEOUT_MS);
         return StringUtil.isNullOrEmpty(manufacturersContent)
-                ? new ManufacturerObject() : JsonUtils.deserialize(manufacturersContent, ManufacturerObject.class);
+            ? new ManufacturerObject() : JsonUtils.deserialize(manufacturersContent, ManufacturerObject.class);
     }
 
 }
diff --git a/eventmesh-webhook/eventmesh-webhook-api/src/main/java/org/apache/eventmesh/webhook/api/WebHookOperationConstant.java b/eventmesh-webhook/eventmesh-webhook-api/src/main/java/org/apache/eventmesh/webhook/api/WebHookOperationConstant.java
index 2a887f68..92de716e 100644
--- a/eventmesh-webhook/eventmesh-webhook-api/src/main/java/org/apache/eventmesh/webhook/api/WebHookOperationConstant.java
+++ b/eventmesh-webhook/eventmesh-webhook-api/src/main/java/org/apache/eventmesh/webhook/api/WebHookOperationConstant.java
@@ -42,8 +42,8 @@ public class WebHookOperationConstant {
     public static final String getFilePath(String filePath) {
         if (filePath.startsWith("#{eventMeshHome}")) {
             String configPath = System.getProperty("confPath", System.getenv("confPath"));
-           
-            filePath = filePath.replace("#{eventMeshHome}", configPath.substring(0,  configPath.lastIndexOf(FILE_SEPARATOR)));
+
+            filePath = filePath.replace("#{eventMeshHome}", configPath.substring(0, configPath.lastIndexOf(FILE_SEPARATOR)));
         }
         return filePath;
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org