tohidemyname opened a new issue, #12613:
URL: https://github.com/apache/dubbo/issues/12613

   <!-- If you need to report a security issue please visit 
https://github.com/apache/dubbo/security/policy -->
   
   - [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) 
of this repository and believe that this is not a duplicate.
   
   ### Environment
   
   * Dubbo version: master
   * Operating System version: windows 11
   * Java version: 20
   
   The code is as follows:
   
     public Result invoke(Invocation invocation) throws RpcException {
   
      ...
       if (value.length() == 0 || "false".equalsIgnoreCase(value)) {
               //no mock
               result = this.invoker.invoke(invocation);
           } else if (value.startsWith("force")) {
               if (logger.isWarnEnabled()) {
                   logger.warn("force-mock: " + invocation.getMethodName() + " 
force-mock enabled , url : " + getUrl());
               }
               //force:direct mock
               result = doMockInvoke(invocation, null);
           } else {
               //fail-mock
               try {
                   result = this.invoker.invoke(invocation);
   
                   //fix:#4585
                   if(result.getException() instanceof RpcException){
                       RpcException rpcException= 
(RpcException)result.getException();
                       if(rpcException.isBiz()){
                           throw  rpcException;
                       }else {
                           result = doMockInvoke(invocation, rpcException);
                       }
                   }
   
               } catch (RpcException e) {
                   if (e.isBiz()) {
                       throw e;
                   }
   
                   if (logger.isWarnEnabled()) {
                       logger.warn("fail-mock: " + invocation.getMethodName() + 
" fail-mock enabled , url : " + getUrl(), e);
                   }
                   result = doMockInvoke(invocation, e);
               }
           }
           return result;
       }
   To fix https://github.com/apache/dubbo/issues/4585,  the following code line 
is put inside a try statement:
   
   result = this.invoker.invoke(invocation);
   
   However, the other statement is not:
   
    if (value.length() == 0 || "false".equalsIgnoreCase(value)) {
               //no mock
               result = this.invoker.invoke(invocation);
           }
   
   Can this code line trigger similar bugs?


-- 
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: notifications-unsubscr...@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to