Pil0tXia commented on code in PR #4507:
URL: https://github.com/apache/eventmesh/pull/4507#discussion_r1370384824


##########
eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/connection/JdbcConnection.java:
##########
@@ -432,13 +442,11 @@ public <T> T preparedQuery(String sql, ResultSetMapper<T> 
resultSetMapper, Prepa
      * @throws SQLException if a database access error occurs.
      */
     public <T> T preparedQuery(String sql, PreparedStatementFactory 
preparedStatementFactory, ResultSetMapper<T> resultSetMapper,
-        PreparedParameter... preparedParameters) throws SQLException {
+                               PreparedParameter... preparedParameters) throws 
SQLException {
 

Review Comment:
   Redundant indention here. We rarely use this kind of line break. There are 
other similar places.



##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/EventMeshUtil.java:
##########
@@ -295,20 +288,20 @@ public static void printState(final ThreadPoolExecutor 
scheduledExecutorService)
     @SuppressWarnings("unchecked")
     public static <T> T cloneObject(final T object) throws IOException, 
ClassNotFoundException {
         try (ByteArrayOutputStream byOut = new ByteArrayOutputStream();
-            ObjectOutputStream outputStream = new ObjectOutputStream(byOut)) {
+             ObjectOutputStream outputStream = new ObjectOutputStream(byOut)) {
 
             outputStream.writeObject(object);
 
             try (ByteArrayInputStream byIn = new 
ByteArrayInputStream(byOut.toByteArray());
-                ObjectInputStream inputStream = new ObjectInputStream(byIn)) {
+                 ObjectInputStream inputStream = new ObjectInputStream(byIn)) {
                 return (T) inputStream.readObject();
             }
         }
 
     }
 
     public static Map<String, Object> getCloudEventExtensionMap(final String 
protocolVersion,
-        final CloudEvent cloudEvent) {
+                                                                final 
CloudEvent cloudEvent) {
         final EventMeshCloudEventWriter eventMeshCloudEventWriter = new 
EventMeshCloudEventWriter();

Review Comment:
   This method signature can be merged into one line.



##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/file/WatchFileTask.java:
##########
@@ -38,10 +40,8 @@ public class WatchFileTask extends Thread {
     private final transient WatchService watchService;
 
     private final transient List<FileChangeListener> fileChangeListeners = new 
ArrayList<>();
-
-    private transient volatile boolean watch = true;
-
     private final transient String directoryPath;
+    private transient volatile boolean watch = true;
 

Review Comment:
   Is this modification necessary? The new line was removed.



##########
eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/connection/JdbcConnection.java:
##########
@@ -46,13 +47,9 @@ public class JdbcConnection implements AutoCloseable {
     private static final String STATEMENT_DELIMITER = ";";
 
     private final JdbcConfig jdbcConfig;
-
-    private volatile Connection connection;
-
     private final InitialOperation initialOperation;
-
     private final ConnectionFactory connectionFactory;
-
+    private volatile Connection connection;
     private JdbcDriverMetaData jdbcDriverMetaData;

Review Comment:
   There is no need to change field positions and blank lines are missing.
   
   Also, the `@Slf4j` annotation on L37 of this class should be located below 
the javadoc.



##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/tcp/codec/Codec.java:
##########
@@ -50,16 +51,81 @@ public class Codec {
     private static final byte[] CONSTANT_MAGIC_FLAG = 
serializeBytes("EventMesh");
     private static final byte[] VERSION = serializeBytes("0000");
 
+    private static Object deserializeBody(String bodyJsonString, Header 
header) throws JsonProcessingException {
+        Command command = header.getCmd();
+        switch (command) {
+            case HELLO_REQUEST:
+            case RECOMMEND_REQUEST:

Review Comment:
   Private methods should be located at the very bottom of a class.



##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/util/EventMeshUtil.java:
##########
@@ -295,20 +288,20 @@ public static void printState(final ThreadPoolExecutor 
scheduledExecutorService)
     @SuppressWarnings("unchecked")
     public static <T> T cloneObject(final T object) throws IOException, 
ClassNotFoundException {
         try (ByteArrayOutputStream byOut = new ByteArrayOutputStream();
-            ObjectOutputStream outputStream = new ObjectOutputStream(byOut)) {
+             ObjectOutputStream outputStream = new ObjectOutputStream(byOut)) {
 
             outputStream.writeObject(object);
 
             try (ByteArrayInputStream byIn = new 
ByteArrayInputStream(byOut.toByteArray());
-                ObjectInputStream inputStream = new ObjectInputStream(byIn)) {
+                 ObjectInputStream inputStream = new ObjectInputStream(byIn)) {
                 return (T) inputStream.readObject();

Review Comment:
   I'm afraid your CheckStyle plugin was misconfigured. Please have a check.
   
   @yanrongzhen Is it a side effect of Spotless plugin? This contributor once 
ran `checkStyleMain` gradle task.



##########
eventmesh-connectors/eventmesh-connector-jdbc/src/main/java/org/apache/eventmesh/connector/jdbc/source/dialect/cdc/mysql/MysqlCdcEngine.java:
##########
@@ -96,12 +96,9 @@
 @Slf4j
 public class MysqlCdcEngine extends AbstractCdcEngine<MysqlAntlr4DdlParser, 
MysqlJdbcContext, MysqlDatabaseDialect> {
 
+    private final EnumMap<EventType, Consumer<Event>> eventHandlers = new 
EnumMap<>(EventType.class);
     private BinaryLogClient client;
-
     private BlockingQueue<Event> eventQueue = new LinkedBlockingQueue<>(10000);
-
-    private final EnumMap<EventType, Consumer<Event>> eventHandlers = new 
EnumMap<>(EventType.class);
-
     private Map<Long/* table number */, TableId> tableIdMap = new 
HashMap<>(64);

Review Comment:
   Field sequence and formating problem. There are other similar places.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to