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/eventmesh.git


The following commit(s) were added to refs/heads/master by this push:
     new e46248ecd [ISSUE #4111] Made an explicit  null check on the map (#4112)
e46248ecd is described below

commit e46248ecd756e5078c6ea6422767e1650a39f97a
Author: Himanshu Sharma <[email protected]>
AuthorDate: Wed Jun 14 07:54:40 2023 +0530

    [ISSUE #4111] Made an explicit  null check on the map (#4112)
    
    * Made an explicit  null check on the map
    
    * Review changes added
    
    * Additional review changes
    
    * Made use of static cnstant
---
 .../protocol/http/push/AsyncHTTPPushRequest.java   | 41 ++++++++++------------
 1 file changed, 19 insertions(+), 22 deletions(-)

diff --git 
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/push/AsyncHTTPPushRequest.java
 
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/push/AsyncHTTPPushRequest.java
index f96e05f58..6ac0461ab 100644
--- 
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/push/AsyncHTTPPushRequest.java
+++ 
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/push/AsyncHTTPPushRequest.java
@@ -218,26 +218,23 @@ public class AsyncHTTPPushRequest extends 
AbstractHTTPPushRequest {
                             result, currPushUrl, handleMsgContext.getTopic(),
                             handleMsgContext.getBizSeqNo(), 
handleMsgContext.getUniqueId(), cost);
                     }
-                    if (result == ClientRetCode.OK || result == 
ClientRetCode.REMOTE_OK) {
-                        complete();
-                        if (isComplete()) {
-                            handleMsgContext.finish();
-                        }
-                    } else if (result == ClientRetCode.RETRY) {
-                        delayRetry();
-                        if (isComplete()) {
-                            handleMsgContext.finish();
-                        }
-                    } else if (result == ClientRetCode.NOLISTEN) {
-                        delayRetry();
-                        if (isComplete()) {
-                            handleMsgContext.finish();
-                        }
-                    } else if (result == ClientRetCode.FAIL) {
-                        complete();
-                        if (isComplete()) {
-                            handleMsgContext.finish();
-                        }
+                    switch (result) {
+                        case OK:
+                        case REMOTE_OK:
+                        case FAIL:
+                            complete();
+                            if (isComplete()) {
+                                handleMsgContext.finish();
+                            }
+                            break;
+                        case RETRY:
+                        case NOLISTEN:
+                            delayRetry();
+                            if (isComplete()) {
+                                handleMsgContext.finish();
+                            }
+                            break;
+                        default: // do nothing
                     }
                 } else {
                     
eventMeshHTTPServer.getMetrics().getSummaryMetrics().recordHttpPushMsgFailed();
@@ -328,7 +325,7 @@ public class AsyncHTTPPushRequest extends 
AbstractHTTPPushRequest {
             Map<String, Object> ret =
                 JsonUtils.parseTypeReferenceObject(content, new 
TypeReference<Map<String, Object>>() {
                 });
-            Integer retCode = (Integer) ret.get("retCode");
+            Integer retCode = (Integer) 
Objects.requireNonNull(ret).get(ProtocolKey.RETCODE);
             if (retCode != null && ClientRetCode.contains(retCode)) {
                 return ClientRetCode.get(retCode);
             }
@@ -340,7 +337,7 @@ public class AsyncHTTPPushRequest extends 
AbstractHTTPPushRequest {
                     handleMsgContext.getBizSeqNo(), 
handleMsgContext.getUniqueId(), content);
             }
             return ClientRetCode.FAIL;
-        } catch (Throwable e) {
+        } catch (Exception e) {
             if (MESSAGE_LOGGER.isWarnEnabled()) {
                 MESSAGE_LOGGER.warn("url:{}, bizSeqno:{}, uniqueId:{},  
httpResponse:{}", currPushUrl,
                     handleMsgContext.getBizSeqNo(), 
handleMsgContext.getUniqueId(), content);


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

Reply via email to