[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #1339: servicecomb参数校验报错,已仔细检查各项参数类型,保持一致

2020-01-14 Thread GitBox
liubao68 commented on issue #1339: servicecomb参数校验报错,已仔细检查各项参数类型,保持一致
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/1339#issuecomment-574452056
 
 
   Close old issue, please feel free to create new one if you meet the problem 
again.


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [servicecomb-java-chassis] liubao68 commented on issue #1339: servicecomb参数校验报错,已仔细检查各项参数类型,保持一致

2019-10-07 Thread GitBox
liubao68 commented on issue #1339: servicecomb参数校验报错,已仔细检查各项参数类型,保持一致
URL: 
https://github.com/apache/servicecomb-java-chassis/issues/1339#issuecomment-539269902
 
 
   Need more details to find the reason. Maybe you can find where the exception 
is thrown and debug the code to find the reasons. 
   
   There is similiar problem:
   
   ```
   下面的异常通常由于客户端传给服务端的参数在反序列化的时候出现异常,比如json格式不匹配。 
由于jackson原始异常会包含业务输入数据,从客户信息泄露的角度,ServiceComb对这种情况没有打印任何任何日志,定位起来稍微麻烦一点。 
   
   定位思路:打开SwaggerProducerOperation类,在抛出异常的地方设置断点, 
参考下面的函数(或者是doInvoke函数,具体看REST定义的时候是否异步),调试看一下抛出来的异常的详细信息,就知道具体原因是啥了。
   
   public void doCompletableFutureInvoke(SwaggerInvocation invocation, 
AsyncResponse asyncResp) {
 try {
   invocation.onBusinessMethodStart();
   
   Object[] args = argumentsMapper.toProducerArgs(invocation);
   for (ProducerInvokeExtension producerInvokeExtension : 
producerInvokeExtenstionList) {
 producerInvokeExtension.beforeMethodInvoke(invocation, this, args);
   }
   
   Object result = producerMethod.invoke(producerInstance, args);
   invocation.onBusinessMethodFinish();
   
   ((CompletableFuture) result).whenComplete((realResult, ex) -> {
 invocation.onBusinessFinish();
 if (ex == null) {
   asyncResp.handle(responseMapper.mapResponse(invocation.getStatus(), 
realResult));
   return;
 }
   
 asyncResp.handle(processException(invocation, ex));
   });
 } catch (IllegalArgumentException ae) {
   invocation.onBusinessMethodFinish();
   invocation.onBusinessFinish();
   asyncResp.handle(processException(invocation,
   new InvocationException(Status.BAD_REQUEST.getStatusCode(), "",
   new CommonExceptionData("Parameters not valid or types not 
match."), ae)));
 } catch (Throwable e) {
   invocation.onBusinessMethodFinish();
   invocation.onBusinessFinish();
   asyncResp.handle(processException(invocation, e));
 }
   }
   
   
   InvocationException: code=400;msg={message=Parameters not valid or types not 
match.}
   org.apache.servicecomb.swagger.invocation.exception.InvocationException: 
InvocationException: code=400;msg={message=Parameters not valid or types not 
match.}
   at 
org.apache.servicecomb.swagger.invocation.exception.ExceptionFactory.doCreate(ExceptionFactory.java:74)
   at 
org.apache.servicecomb.swagger.invocation.exception.ExceptionFactory.create(ExceptionFactory.java:61)
   
   ```


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services